summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c2
-rw-r--r--src/char/int_storage.c14
-rw-r--r--src/char/int_storage.h1
3 files changed, 16 insertions, 1 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 487bec763..5a5a0d7f2 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -296,7 +296,7 @@ void char_set_char_offline(int char_id, int account_id)
idb_remove(chr->char_db_,char_id);
if (stor) /* Remove inter-storage data. */
- idb_remove(inter_storage->account_storage, account_id);
+ inter_storage->delete_account_storage(account_id);
if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) )
Sql_ShowDebug(inter->sql_handle);
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index 5f005005e..d5e5389c7 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -365,6 +365,19 @@ int inter_storage_guild_storage_delete(int guild_id)
return 0;
}
+/**
+ * Delete storage from memory for given account_id.
+ * @param account_id [in] account id
+ */
+void inter_storage_delete_account_storage(int account_id)
+{
+ struct storage_data *stor = (struct storage_data *)idb_get(inter_storage->account_storage, account_id);
+ if (stor == NULL)
+ return;
+ VECTOR_CLEAR(stor->item);
+ idb_remove(inter_storage->account_storage, account_id);
+}
+
//---------------------------------------------------------
// packet from map server
@@ -792,6 +805,7 @@ void inter_storage_defaults(void)
inter_storage->sql_init = inter_storage_sql_init;
inter_storage->sql_final = inter_storage_sql_final;
inter_storage->delete_ = inter_storage_delete;
+ inter_storage->delete_account_storage = inter_storage_delete_account_storage;
inter_storage->guild_storage_delete = inter_storage_guild_storage_delete;
inter_storage->parse_frommap = inter_storage_parse_frommap;
}
diff --git a/src/char/int_storage.h b/src/char/int_storage.h
index 1f6c03f13..746629421 100644
--- a/src/char/int_storage.h
+++ b/src/char/int_storage.h
@@ -44,6 +44,7 @@ struct inter_storage_interface {
int (*sql_init) (void);
void (*sql_final) (void);
int (*delete_) (int account_id);
+ void (*delete_account_storage) (int account_id);
int (*guild_storage_delete) (int guild_id);
int (*parse_frommap) (int fd);
};