Pārlūkot izejas kodu

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.

aleos89 10 gadi atpakaļ
vecāks
revīzija
f077a8eb03
3 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. 1 1
      sql-files/main.sql
  2. 1 0
      sql-files/upgrades/upgrade_20140826.sql
  3. 3 1
      src/char/char.c

+ 1 - 1
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`),

+ 1 - 0
sql-files/upgrades/upgrade_20140826.sql

@@ -0,0 +1 @@
+ALTER TABLE `char` MODIFY COLUMN `uniqueitem_counter` int(11) unsigned NOT NULL default '0';

+ 3 - 1
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);