summaryrefslogtreecommitdiff
path: root/src/map/chrif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r--src/map/chrif.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index ddc106d0c..0622621bb 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -310,8 +310,12 @@ static bool chrif_save(struct map_session_data *sd, int flag)
if (sd->state.storage_flag == STORAGE_FLAG_GUILD)
gstorage->save(sd->status.account_id, sd->status.guild_id, flag);
- if (flag)
- sd->state.storage_flag = STORAGE_FLAG_CLOSED; //Force close it.
+ if (flag != 0 && sd->state.storage_flag != STORAGE_FLAG_CLOSED) {
+ if (sd->state.storage_flag == STORAGE_FLAG_NORMAL)
+ storage->close(sd);
+ else if (sd->state.storage_flag == STORAGE_FLAG_GUILD)
+ gstorage->close(sd);
+ }
//Saving of registry values.
if (sd->vars_dirty)
@@ -339,8 +343,9 @@ static bool chrif_save(struct map_session_data *sd, int flag)
if (VECTOR_LENGTH(sd->achievement) > 0)
intif->achievements_save(sd);
- if (sd->storage.received == true && sd->storage.save == true)
- intif->send_account_storage(sd);
+ for (int i = 0; i < VECTOR_LENGTH(sd->storage.list); i++)
+ if (VECTOR_INDEX(sd->storage.list, i).received && VECTOR_INDEX(sd->storage.list, i).save)
+ intif->send_account_storage(sd, VECTOR_INDEX(sd->storage.list, i).uid);
return true;
}