Ver código fonte

- Fixed guild storage being "eternally in use" if you quit/logout before closing it.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7395 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 anos atrás
pai
commit
eba9a34f0b
4 arquivos alterados com 13 adições e 8 exclusões
  1. 2 0
      Changelog-Trunk.txt
  2. 1 1
      src/map/chrif.c
  3. 9 6
      src/map/storage.c
  4. 1 1
      src/map/storage.h

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ 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.
 
 2006/05/29
+	* Fixed guild storage being "eternally in use" if you quit/logout before
+	  closing it. [Skotlex]
 	* Ending SC_CLOAK/SC_HIDE/SC_CHASEWALK will now trigger ontouch npcs.
 	  [Skotlex]
 	* [Fixed]

+ 1 - 1
src/map/chrif.c

@@ -192,7 +192,7 @@ int chrif_save(struct map_session_data *sd, int flag)
 	if (sd->state.storage_flag == 1)
 		storage_storage_save(sd->status.account_id, flag);
 	else if (sd->state.storage_flag == 2)
-		storage_guild_storagesave(sd->status.account_id, sd->status.guild_id);
+		storage_guild_storagesave(sd->status.account_id, sd->status.guild_id, flag);
 
 	//Saving of registry values. 
 	if (sd->state.reg_dirty&4)

+ 9 - 6
src/map/storage.c

@@ -76,7 +76,7 @@ static int storage_reconnect_sub(DBKey key,void *data,va_list ap)
 	{	//Guild Storage
 		struct guild_storage* stor = (struct guild_storage*) data;
 		if (stor->dirty && stor->storage_status == 0) //Save closed storages.
-			storage_guild_storagesave(0, stor->guild_id);
+			storage_guild_storagesave(0, stor->guild_id,0);
 	}
 	else
 	{	//Account Storage
@@ -674,13 +674,16 @@ int storage_guild_storagegettocart(struct map_session_data *sd,int index,int amo
 	return 1;
 }
 
-int storage_guild_storagesave(int account_id, int guild_id)
+int storage_guild_storagesave(int account_id, int guild_id, int flag)
 {
 	struct guild_storage *stor = guild2storage2(guild_id);
 
-	if(stor && stor->dirty)
+	if(stor)
 	{
-		intif_send_guild_storage(account_id,stor);
+		if (flag) //Char quitting, close it.
+			stor->storage_status = 0;
+	 	if (stor->dirty)
+			intif_send_guild_storage(account_id,stor);
 		return 1;
 	}
 	return 0;
@@ -714,7 +717,7 @@ int storage_guild_storageclose(struct map_session_data *sd)
 		if (save_settings&4)
 			chrif_save(sd, 0); //This one also saves the storage. [Skotlex]
 		else
-			storage_guild_storagesave(sd->status.account_id, sd->status.guild_id);
+			storage_guild_storagesave(sd->status.account_id, sd->status.guild_id,0);
 	}
 	stor->storage_status=0;
 	sd->state.storage_flag = 0;
@@ -743,7 +746,7 @@ int storage_guild_storage_quit(struct map_session_data *sd,int flag)
 		if (save_settings&4)
 			chrif_save(sd,0);
 		else
-			storage_guild_storagesave(sd->status.account_id,sd->status.guild_id);
+			storage_guild_storagesave(sd->status.account_id,sd->status.guild_id,1);
 	}
 	sd->state.storage_flag = 0;
 	stor->storage_status = 0;

+ 1 - 1
src/map/storage.h

@@ -34,7 +34,7 @@ int storage_guild_storageaddfromcart(struct map_session_data *sd,int index,int a
 int storage_guild_storagegettocart(struct map_session_data *sd,int index,int amount);
 int storage_guild_storageclose(struct map_session_data *sd);
 int storage_guild_storage_quit(struct map_session_data *sd,int flag);
-int storage_guild_storagesave(int account_id, int guild_id);
+int storage_guild_storagesave(int account_id, int guild_id, int flag);
 int storage_guild_storagesaved(int guild_id); //Ack from char server that guild store was saved.
 
 int storage_comp_item(const void *_i1, const void *_i2);