From e8affc41f106503b530abaa7faa20d6e63b727b8 Mon Sep 17 00:00:00 2001 From: Smokexyz Date: Fri, 28 Apr 2017 05:57:39 +0800 Subject: 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. --- src/common/mmo.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/mmo.h b/src/common/mmo.h index b3069b27c..204e70dd1 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -23,6 +23,7 @@ #include "config/core.h" #include "common/cbasetypes.h" +#include "common/db.h" // VECTORS // server->client protocol version // 0 - pre-? @@ -479,8 +480,10 @@ struct status_change_data { }; struct storage_data { - int storage_amount; - struct item items[MAX_STORAGE]; + bool save; ///< save flag. + bool received; ///< received flag. + int aggregate; ///< total item count. + VECTOR_DECL(struct item) item; ///< item vector. }; struct guild_storage { @@ -616,7 +619,6 @@ struct mmo_charstatus { struct point last_point,save_point,memo_point[MAX_MEMOPOINTS]; struct item inventory[MAX_INVENTORY],cart[MAX_CART]; - struct storage_data storage; struct s_skill skill[MAX_SKILL]; struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex] -- cgit v1.2.3-60-g2f50