Kaynağa Gözat

Status Saving

Fixed status saving in general, now cart will always be loaded.
Lemongrass3110 11 yıl önce
ebeveyn
işleme
3f1242edfd
2 değiştirilmiş dosya ile 4 ekleme ve 9 silme
  1. 4 6
      src/char/char.c
  2. 0 3
      src/map/chrif.c

+ 4 - 6
src/char/char.c

@@ -3308,10 +3308,6 @@ int parse_frommap(int fd)
 					WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data);
 					WFIFOW(fd,12) = count;
 					WFIFOSET(fd,WFIFOW(fd,2));
-
-					//Clear the data once loaded.
-					if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) )
-						Sql_ShowDebug(sql_handle);
 				}
 			}
 			Sql_FreeResult(sql_handle);
@@ -3715,8 +3711,10 @@ int parse_frommap(int fd)
 			cid = RFIFOL(fd, 8);
 			count = RFIFOW(fd, 12);
 
-			if( count > 0 )
-			{
+			// Whatever comes from the mapserver, now is the time to drop previous entries
+			if( Sql_Query( sql_handle, "DELETE FROM `%s` where `account_id` = %d and `char_id` = %d;", scdata_db, aid, cid ) != SQL_SUCCESS ){
+				Sql_ShowDebug( sql_handle );
+			}else if( count > 0 ){
 				struct status_change_data data;
 				StringBuf buf;
 				int i;

+ 0 - 3
src/map/chrif.c

@@ -1296,9 +1296,6 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
 		count++;
 	}
 
-	if (count == 0)
-		return 0; //Nothing to save.
-
 	WFIFOW(char_fd,12) = count;
 	WFIFOW(char_fd,2) = 14 +count*sizeof(struct status_change_data); //Total packet size
 	WFIFOSET(char_fd,WFIFOW(char_fd,2));