diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-07-30 04:37:21 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-07-30 04:37:21 +0000 |
commit | eb41b65a824afc0c583d1392b2ee24493e6f6189 (patch) | |
tree | 9efa479e985068f61cc5326dc9c6bf8d6b2dadc0 /src/char | |
parent | 2bf514e9c2c17de4873a238f2a4a4c2a052571a8 (diff) | |
download | hercules-eb41b65a824afc0c583d1392b2ee24493e6f6189.tar.gz hercules-eb41b65a824afc0c583d1392b2ee24493e6f6189.tar.bz2 hercules-eb41b65a824afc0c583d1392b2ee24493e6f6189.tar.xz hercules-eb41b65a824afc0c583d1392b2ee24493e6f6189.zip |
Fixed TXT storage code handling storage incorrectly (bugreport:1928)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13016 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/char/char.c b/src/char/char.c index cedf7caa2..d1225aee1 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -988,8 +988,6 @@ int mmo_char_init(void) ret = mmo_char_fromstr(line, &char_dat[char_num].status, char_dat[char_num].global, &char_dat[char_num].global_num); - // load storage - storage_load(char_dat[char_num].status.account_id, &char_dat[char_num].status.storage); // Initialize friends list parse_friend_txt(&char_dat[char_num].status); // Grab friends for the character // Initialize hotkey list @@ -2718,12 +2716,9 @@ int parse_frommap(int fd) case 0x2b01: // Receive character data from map-server for saving if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; - for(i = 0; i < char_num; i++) { - if (char_dat[i].status.account_id == RFIFOL(fd,4) && - char_dat[i].status.char_id == RFIFOL(fd,8)) - break; - } - if (i != char_num) + + ARR_FIND( 0, char_num, i, char_dat[i].status.account_id == RFIFOL(fd,4) && char_dat[i].status.char_id == RFIFOL(fd,8) ); + if( i < char_num ) { memcpy(&char_dat[i].status, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); storage_save(char_dat[i].status.account_id, &char_dat[i].status.storage); @@ -3112,6 +3107,7 @@ int parse_frommap(int fd) WFIFOL(fd,12) = node->login_id2; WFIFOL(fd,16) = (uint32)node->expiration_time; // FIXME: will wrap to negative after "19-Jan-2038, 03:14:07 AM GMT" WFIFOL(fd,20) = node->gmlevel; + storage_load(cd->account_id, &cd->storage); //FIXME: storage is used as a temp buffer here memcpy(WFIFOP(fd,24), cd, sizeof(struct mmo_charstatus)); WFIFOSET(fd, WFIFOW(fd,2)); |