From f077a8eb0385373a12f80956c6269bbd15163a8c Mon Sep 17 00:00:00 2001 From: aleos89 Date: Tue, 26 Aug 2014 16:35:58 -0400 Subject: [PATCH] Follow up to c0ed836. - Optimized SQL structure to better fit uint32 value for uniqueitem_counter. (bugreport:9249) - Added font and uniqueitem_counter to load when loading character menu on char-server. --- sql-files/main.sql | 2 +- sql-files/upgrades/upgrade_20140826.sql | 1 + src/char/char.c | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 sql-files/upgrades/upgrade_20140826.sql diff --git a/sql-files/main.sql b/sql-files/main.sql index ad5197f33d..0f32ea5684 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -124,7 +124,7 @@ CREATE TABLE IF NOT EXISTS `char` ( `moves` int(11) unsigned NOT NULL DEFAULT '0', `unban_time` int(11) unsigned NOT NULL default '0', `font` tinyint(3) unsigned NOT NULL default '0', - `uniqueitem_counter` bigint(20) NOT NULL, + `uniqueitem_counter` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`char_id`), UNIQUE KEY `name_key` (`name`), KEY `account_id` (`account_id`), diff --git a/sql-files/upgrades/upgrade_20140826.sql b/sql-files/upgrades/upgrade_20140826.sql new file mode 100644 index 0000000000..9235f4a1e1 --- /dev/null +++ b/sql-files/upgrades/upgrade_20140826.sql @@ -0,0 +1 @@ +ALTER TABLE `char` MODIFY COLUMN `uniqueitem_counter` int(11) unsigned NOT NULL default '0'; diff --git a/src/char/char.c b/src/char/char.c index 96476e8dbb..10683e5821 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -879,7 +879,7 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) { "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," "`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," - "`robe`,`moves`, `unban_time`" + "`robe`,`moves`,`unban_time`,`font`,`uniqueitem_counter`" " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", schema_config.char_db, sd->account_id, MAX_CHARS) || SQL_ERROR == SqlStmt_Execute(stmt) || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL) @@ -920,6 +920,8 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) { || SQL_ERROR == SqlStmt_BindColumn(stmt, 35, SQLDT_SHORT, &p.robe, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 36, SQLDT_UINT, &p.character_moves, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 37, SQLDT_LONG, &p.unban_time, 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 38, SQLDT_UCHAR, &p->font, 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 39, SQLDT_UINT, &p->uniqueitem_counter, 0, NULL, NULL) ) { SqlStmt_ShowDebug(stmt);