diff options
author | Paradox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-02-09 20:26:42 +0000 |
---|---|---|
committer | Paradox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-02-09 20:26:42 +0000 |
commit | 0034a439b74142f27a93b422ef66eaa90ddb7ab3 (patch) | |
tree | 560d2c8f405398602ab425d3c97ab3acd3c96d65 | |
parent | 321fad2e5e3ceff3f624d124565b22ca9868db9f (diff) | |
download | hercules-0034a439b74142f27a93b422ef66eaa90ddb7ab3.tar.gz hercules-0034a439b74142f27a93b422ef66eaa90ddb7ab3.tar.bz2 hercules-0034a439b74142f27a93b422ef66eaa90ddb7ab3.tar.xz hercules-0034a439b74142f27a93b422ef66eaa90ddb7ab3.zip |
Expanded range for cached and stored-in-db guild member exp (devotion) from uint32 to uint64. (bugreport:3983)
Capped value when sending to client to INT_MAX to prevent confusion.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14242 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 3 | ||||
-rw-r--r-- | sql-files/main.sql | 2 | ||||
-rw-r--r-- | sql-files/upgrade_svn14241.sql | 1 | ||||
-rw-r--r-- | src/char/int_guild.c | 6 | ||||
-rw-r--r-- | src/char_sql/int_guild.c | 4 | ||||
-rw-r--r-- | src/common/mmo.h | 2 | ||||
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/guild.c | 16 |
8 files changed, 20 insertions, 16 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index bfa0f7a33..f19d0418b 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,9 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2010/02/09 + * Expanded range for cached and stored-in-db guild member exp (devotion) from uint32 to uint64. (bugreport:3983) [Paradox924X] + * Capped value when sending to client to INT_MAX to prevent confusion. [Paradox924X] 2010/02/07 * Bleeding doesn't kill non-player characters. [Inkfish] 2010/02/06 diff --git a/sql-files/main.sql b/sql-files/main.sql index 2e1663416..f67bfd2d8 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -182,7 +182,7 @@ CREATE TABLE IF NOT EXISTS `guild` ( `connect_member` tinyint(6) unsigned NOT NULL default '0', `max_member` tinyint(6) unsigned NOT NULL default '0', `average_lv` smallint(6) unsigned NOT NULL default '1', - `exp` int(11) unsigned NOT NULL default '0', + `exp` bigint(20) unsigned NOT NULL default '0', `next_exp` int(11) unsigned NOT NULL default '0', `skill_point` tinyint(11) unsigned NOT NULL default '0', `mes1` varchar(60) NOT NULL default '', diff --git a/sql-files/upgrade_svn14241.sql b/sql-files/upgrade_svn14241.sql new file mode 100644 index 000000000..2c1b9c5f7 --- /dev/null +++ b/sql-files/upgrade_svn14241.sql @@ -0,0 +1 @@ +ALTER TABLE `guild` MODIFY COLUMN `exp` bigint(20) unsigned NOT NULL default '0';
\ No newline at end of file diff --git a/src/char/int_guild.c b/src/char/int_guild.c index dac684391..e9b77f184 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -49,7 +49,7 @@ int inter_guild_tostr(char* str, struct guild* g) for(i = 0; i < g->max_member; i++) { struct guild_member *m = &g->member[i]; - len += sprintf(str + len, "%d,%d,%d,%d,%d,%d,%d,%u,%d,%d\t%s\t", + len += sprintf(str + len, "%d,%d,%d,%d,%d,%d,%d,%llu,%d,%d\t%s\t", m->account_id, m->char_id, m->hair, m->hair_color, m->gender, m->class_, m->lv, m->exp, m->exp_payper, m->position, @@ -150,7 +150,7 @@ int inter_guild_fromstr(char* str, struct guild* g) int charid; int hair, hair_color, gender; int class_, lv; - unsigned int exp; + uint64 exp; int exp_payper; int position; char name[256]; // only 24 used @@ -160,7 +160,7 @@ int inter_guild_fromstr(char* str, struct guild* g) for( i = 0; i < g->max_member; i++ ) { struct guild_member* m = &g->member[i]; - if (sscanf(str, "%d,%d,%d,%d,%d,%d,%d,%u,%d,%d\t%[^\t]\t%n", + if (sscanf(str, "%d,%d,%d,%d,%d,%d,%d,%llu,%d,%d\t%[^\t]\t%n", &accountid, &charid, &hair, &hair_color, &gender, &class_, &lv, &exp, &exp_payper, &position, name, &len) < 11) diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c index 24b0cea7b..8a499a095 100644 --- a/src/char_sql/int_guild.c +++ b/src/char_sql/int_guild.c @@ -265,7 +265,7 @@ int inter_guild_tosql(struct guild *g,int flag) //Since nothing references guild member table as foreign keys, it's safe to use REPLACE INTO Sql_EscapeStringLen(sql_handle, esc_name, m->name, strnlen(m->name, NAME_LENGTH)); if( SQL_ERROR == Sql_Query(sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`name`) " - "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%u','%d','%d','%d','%s')", + "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%llu','%d','%d','%d','%s')", guild_member_db, g->guild_id, m->account_id, m->char_id, m->hair, m->hair_color, m->gender, m->class_, m->lv, m->exp, m->exp_payper, m->online, m->position, esc_name) ) @@ -455,7 +455,7 @@ struct guild * inter_guild_fromsql(int guild_id) Sql_GetData(sql_handle, 4, &data, NULL); m->gender = atoi(data); Sql_GetData(sql_handle, 5, &data, NULL); m->class_ = atoi(data); Sql_GetData(sql_handle, 6, &data, NULL); m->lv = atoi(data); - Sql_GetData(sql_handle, 7, &data, NULL); m->exp = (unsigned int)strtoul(data, NULL, 10); + Sql_GetData(sql_handle, 7, &data, NULL); m->exp = (uint64)strtoull(data, NULL, 10); Sql_GetData(sql_handle, 8, &data, NULL); m->exp_payper = (unsigned int)atoi(data); Sql_GetData(sql_handle, 9, &data, NULL); m->online = atoi(data); Sql_GetData(sql_handle, 10, &data, NULL); m->position = atoi(data); diff --git a/src/common/mmo.h b/src/common/mmo.h index e7cb5b572..8f31a9e0f 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -425,7 +425,7 @@ struct map_session_data; struct guild_member { int account_id, char_id; short hair,hair_color,gender,class_,lv; - unsigned int exp; + uint64 exp; int exp_payper; short online,position; char name[NAME_LENGTH]; diff --git a/src/map/clif.c b/src/map/clif.c index f9fd3ffca..db6d4a291 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6616,7 +6616,7 @@ int clif_guild_memberlist(struct map_session_data *sd) WFIFOW(fd,c*104+16)=m->gender; WFIFOW(fd,c*104+18)=m->class_; WFIFOW(fd,c*104+20)=m->lv; - WFIFOL(fd,c*104+22)=m->exp; + WFIFOL(fd,c*104+22)=cap_value(m->exp,0,INT_MAX); WFIFOL(fd,c*104+26)=m->online; WFIFOL(fd,c*104+30)=m->position; memset(WFIFOP(fd,c*104+34),0,50); // メモ? diff --git a/src/map/guild.c b/src/map/guild.c index e7b9f4096..8cb263a87 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -48,7 +48,7 @@ struct eventlist { // ギルドのEXPキャッシュ struct guild_expcache { int guild_id, account_id, char_id; - unsigned int exp; + uint64 exp; }; static struct eri *expcache_ers; //For handling of guild exp payment. @@ -343,8 +343,8 @@ int guild_payexp_timer_sub(DBKey dataid, void *data, va_list ap) return 0; } - if (g->member[i].exp > UINT_MAX - c->exp) - g->member[i].exp = UINT_MAX; + if (g->member[i].exp > UINT64_MAX - c->exp) + g->member[i].exp = UINT64_MAX; else g->member[i].exp+= c->exp; @@ -1193,13 +1193,13 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) if (per < 100) - exp = (unsigned int) exp * per / 100; + exp = exp * per / 100; //Otherwise tax everything. c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd); - if (c->exp > UINT_MAX - exp) - c->exp = UINT_MAX; + if (c->exp > UINT64_MAX - exp) + c->exp = UINT64_MAX; else c->exp += exp; @@ -1217,8 +1217,8 @@ int guild_getexp(struct map_session_data *sd,int exp) return 0; c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd); - if (c->exp > UINT_MAX - exp) - c->exp = UINT_MAX; + if (c->exp > UINT64_MAX - exp) + c->exp = UINT64_MAX; else c->exp += exp; return exp; |