summaryrefslogtreecommitdiff
path: root/src/map/chrif.c
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-03-08 11:45:01 -0300
committerJesusaves <cpntb1@ymail.com>2021-03-08 11:45:01 -0300
commit05c1c0552fe6c94d8835a58f4608d0402614ce39 (patch)
tree25c6cddf9cd1767835266171d26d86d04882fdee /src/map/chrif.c
parent36b0aad136e42687ed5f5383f8d93128d73c398b (diff)
downloadhercules-05c1c0552fe6c94d8835a58f4608d0402614ce39.tar.gz
hercules-05c1c0552fe6c94d8835a58f4608d0402614ce39.tar.bz2
hercules-05c1c0552fe6c94d8835a58f4608d0402614ce39.tar.xz
hercules-05c1c0552fe6c94d8835a58f4608d0402614ce39.zip
[TMW2] Hercules Ultimate Storage System
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;
}