Selaa lähdekoodia

Fixed TXT storage code handling storage incorrectly (bugreport:1928)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13016 54d463be-8e91-2dee-dedb-b68131a5f0ec
ultramage 17 vuotta sitten
vanhempi
commit
9fd3dfd23b
2 muutettua tiedostoa jossa 5 lisäystä ja 8 poistoa
  1. 1 0
      Changelog-Trunk.txt
  2. 4 8
      src/char/char.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2008/07/30
+	* Fixed TXT storage code handling storage incorrectly (bugreport:1928)
 	* AccountDB_TXT will now correctly read inconsistent EOLs (bugreport:1934)
 	* Removed the IRC bot system, now a customization (see topic:194306)
 2008/07/29

+ 4 - 8
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));