From adf2854618745572b076a2b4a6343e63374c1182 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 29 Jun 2006 15:53:30 +0000 Subject: - Fixed guild storage being "eternally in use" if you quit/logout before closing it. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7395 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/map/chrif.c | 2 +- src/map/storage.c | 15 +++++++++------ src/map/storage.h | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 81dfaeb6b..90348b06a 100644 --- a/Changelog-Trunk.txt +++ b/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] diff --git a/src/map/chrif.c b/src/map/chrif.c index 5e622864f..c5b71db03 100644 --- a/src/map/chrif.c +++ b/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) diff --git a/src/map/storage.c b/src/map/storage.c index 0be5d756d..29b48527d 100644 --- a/src/map/storage.c +++ b/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; diff --git a/src/map/storage.h b/src/map/storage.h index e33505062..b62ddb47a 100644 --- a/src/map/storage.h +++ b/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); -- cgit v1.2.3-60-g2f50