summaryrefslogtreecommitdiff
path: root/src/char/mapif.c
diff options
context:
space:
mode:
authorSmokexyz <sagunkho@hotmail.com>2017-04-28 05:57:39 +0800
committerSmokexyz <sagunkho@hotmail.com>2017-05-22 17:55:49 +0800
commite8affc41f106503b530abaa7faa20d6e63b727b8 (patch)
tree4e4418da2e850e9ae89f357d8b396da5ec739ac4 /src/char/mapif.c
parent109661e3d5fb4cc6ddde9b32f8c99012c8d17bce (diff)
downloadhercules-e8affc41f106503b530abaa7faa20d6e63b727b8.tar.gz
hercules-e8affc41f106503b530abaa7faa20d6e63b727b8.tar.bz2
hercules-e8affc41f106503b530abaa7faa20d6e63b727b8.tar.xz
hercules-e8affc41f106503b530abaa7faa20d6e63b727b8.zip
Add storage_data reception, parsing and sending to/from the map-server.
Remove loading and saving of storage_data through char.c Re-declaration of structure storage_data as a vector. Re-code of portions in the map-server using storage_data. A new approach is taken by saving the loaded storage data from sql into memory for the duration of the session, thereby removing the need of querying the database to re-load all items everytime a storage save routine is issued from the map-server. Saving of storage items is done through a new function that significantly reduces the number of queries compared to char_memitemdata_tosql(), and therefore run-time speed. This method potentially reduces the number of update and delete queries from MAX_STORAGE (which could be >= 600) times to literally 1. Storage items are stored in a dynamically allocated array and handled accordingly. struct mmo_charstatus size reduces by 34,800 bytes. Update pc_checkitem() with masks for item checks. `sd->state.itemcheck` has been changed to `sd->itemcheck` of type `enum pc_checkitem_types` `battle/items.conf` has been updated to reflect configuration changes. Further updates to assert a successful reception of storage data in related functions.
Diffstat (limited to 'src/char/mapif.c')
-rw-r--r--src/char/mapif.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/char/mapif.c b/src/char/mapif.c
index 1dafb79c3..5fff96ba8 100644
--- a/src/char/mapif.c
+++ b/src/char/mapif.c
@@ -186,6 +186,10 @@ int mapif_load_guild_storage(int fd,int account_id,int guild_id, char flag);
int mapif_save_guild_storage_ack(int fd, int account_id, int guild_id, int fail);
int mapif_parse_LoadGuildStorage(int fd);
int mapif_parse_SaveGuildStorage(int fd);
+int mapif_account_storage_load(int fd, int account_id);
+int mapif_parse_AccountStorageLoad(int fd);
+int mapif_parse_AccountStorageSave(int fd);
+void mapif_send_AccountStorageSaveAck(int fd, int account_id, bool save);
int mapif_itembound_ack(int fd, int aid, int guild_id);
int mapif_parse_ItemBoundRetrieve_sub(int fd);
void mapif_parse_ItemBoundRetrieve(int fd);
@@ -363,6 +367,10 @@ void mapif_defaults(void) {
mapif->save_guild_storage_ack = mapif_save_guild_storage_ack;
mapif->parse_LoadGuildStorage = mapif_parse_LoadGuildStorage;
mapif->parse_SaveGuildStorage = mapif_parse_SaveGuildStorage;
+ mapif->pAccountStorageLoad = mapif_parse_AccountStorageLoad;
+ mapif->pAccountStorageSave = mapif_parse_AccountStorageSave;
+ mapif->sAccountStorageSaveAck = mapif_send_AccountStorageSaveAck;
+ mapif->account_storage_load = mapif_account_storage_load;
mapif->itembound_ack = mapif_itembound_ack;
mapif->parse_ItemBoundRetrieve_sub = mapif_parse_ItemBoundRetrieve_sub;
mapif->parse_ItemBoundRetrieve = mapif_parse_ItemBoundRetrieve;