summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chrif.c2
-rw-r--r--src/map/storage.c15
-rw-r--r--src/map/storage.h2
3 files changed, 11 insertions, 8 deletions
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);