diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-22 16:52:46 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-22 16:52:46 +0000 |
commit | 2a3ca1bcfa82023b3f890f19775b115e8a744b88 (patch) | |
tree | 589420d27d8276eb70e90fd686ac92385830965a /src/map | |
parent | 873717f2814a890f5b8c52f0302d6cd67e3e29f6 (diff) | |
download | hercules-2a3ca1bcfa82023b3f890f19775b115e8a744b88.tar.gz hercules-2a3ca1bcfa82023b3f890f19775b115e8a744b88.tar.bz2 hercules-2a3ca1bcfa82023b3f890f19775b115e8a744b88.tar.xz hercules-2a3ca1bcfa82023b3f890f19775b115e8a744b88.zip |
* Fixed guild and guild member exp truncation issue (bugreport:4130, since r14242).
- Fixed guild member position, hair, hair color, gender, class and level could potentially become corrupted due to shorts being read as ints (partially since r2986).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14487 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/guild.c | 2 | ||||
-rw-r--r-- | src/map/guild.h | 2 | ||||
-rw-r--r-- | src/map/intif.c | 19 |
5 files changed, 13 insertions, 14 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 77aef527f..ead204fb5 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3084,7 +3084,7 @@ ACMD_FUNC(guildlevelup) added_level = 1 - guild_info->guild_lv; if (added_level != 0) { - intif_guild_change_basicinfo(guild_info->guild_id, GBI_GUILDLV, &added_level, 2); + intif_guild_change_basicinfo(guild_info->guild_id, GBI_GUILDLV, &added_level, sizeof(added_level)); clif_displaymessage(fd, msg_txt(179)); // Guild level changed. } else { clif_displaymessage(fd, msg_txt(45)); // Guild level change failed. diff --git a/src/map/clif.c b/src/map/clif.c index 94c19287a..087a41187 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6804,7 +6804,7 @@ int clif_guild_basicinfo(struct map_session_data *sd) WFIFOL(fd,10)=g->connect_member; WFIFOL(fd,14)=g->max_member; WFIFOL(fd,18)=g->average_lv; - WFIFOL(fd,22)=g->exp; + WFIFOL(fd,22)=(uint32)cap_value(g->exp,0,INT_MAX); WFIFOL(fd,26)=g->next_exp; WFIFOL(fd,30)=0; // Tax Points WFIFOL(fd,34)=0; // Tendency: (left) Vulgar [-100,100] Famed (right) diff --git a/src/map/guild.c b/src/map/guild.c index 1b91dfc93..cdc978929 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1003,7 +1003,7 @@ int guild_recv_message(int guild_id,int account_id,const char *mes,int len) return 0; } // ギルドメンバの役職変更 -int guild_change_memberposition(int guild_id,int account_id,int char_id,int idx) +int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx) { return intif_guild_change_memberinfo(guild_id,account_id,char_id,GMI_POSITION,&idx,sizeof(idx)); } diff --git a/src/map/guild.h b/src/map/guild.h index 753de0da1..c6b380647 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -73,7 +73,7 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag); int guild_send_memberinfoshort(struct map_session_data *sd,int online); int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_); -int guild_change_memberposition(int guild_id,int account_id,int char_id,int idx); +int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx); int guild_memberposition_changed(struct guild *g,int idx,int pos); int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char *name); int guild_position_changed(int guild_id,int idx,struct guild_position *p); diff --git a/src/map/intif.c b/src/map/intif.c index c8aad3807..ba5230bab 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -1124,7 +1124,7 @@ int intif_parse_GuildBasicInfoChanged(int fd) return 0; switch(type) { - case GBI_EXP: g->exp = RFIFOL(fd,10); break; + case GBI_EXP: g->exp = RFIFOQ(fd,10); break; case GBI_GUILDLV: g->guild_lv = RFIFOW(fd,10); break; case GBI_SKILLPOINT: g->skill_point = RFIFOL(fd,10); break; } @@ -1141,8 +1141,7 @@ int intif_parse_GuildMemberInfoChanged(int fd) int account_id = RFIFOL(fd,8); int char_id = RFIFOL(fd,12); int type = RFIFOW(fd,16); - void* data = RFIFOP(fd,18); - int dd = *((int *)data); + //void* data = RFIFOP(fd,18); struct guild* g; int idx; @@ -1156,13 +1155,13 @@ int intif_parse_GuildMemberInfoChanged(int fd) return 0; switch( type ) { - case GMI_POSITION: g->member[idx].position = dd; guild_memberposition_changed(g,idx,dd); break; - case GMI_EXP: g->member[idx].exp = dd; break; - case GMI_HAIR: g->member[idx].hair = dd; break; - case GMI_HAIR_COLOR: g->member[idx].hair_color = dd; break; - case GMI_GENDER: g->member[idx].gender = dd; break; - case GMI_CLASS: g->member[idx].class_ = dd; break; - case GMI_LEVEL: g->member[idx].lv = dd; break; + case GMI_POSITION: g->member[idx].position = RFIFOW(fd,18); guild_memberposition_changed(g,idx,RFIFOW(fd,18)); break; + case GMI_EXP: g->member[idx].exp = RFIFOQ(fd,18); break; + case GMI_HAIR: g->member[idx].hair = RFIFOW(fd,18); break; + case GMI_HAIR_COLOR: g->member[idx].hair_color = RFIFOW(fd,18); break; + case GMI_GENDER: g->member[idx].gender = RFIFOW(fd,18); break; + case GMI_CLASS: g->member[idx].class_ = RFIFOW(fd,18); break; + case GMI_LEVEL: g->member[idx].lv = RFIFOW(fd,18); break; } return 0; } |