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/map/itemdb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/map/itemdb.c') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index a35aa67f1..8b374c2bf 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -2487,16 +2487,20 @@ void itemdb_reload(void) { for (sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) { memset(sd->item_delay, 0, sizeof(sd->item_delay)); // reset item delays pc->setinventorydata(sd); - if( battle_config.item_check ) - sd->state.itemcheck = 1; + + if (battle->bc->item_check != PCCHECKITEM_NONE) // Check and flag items for inspection. + sd->itemcheck = (enum pc_checkitem_types) battle->bc->item_check; + /* clear combo bonuses */ - if( sd->combo_count ) { + if (sd->combo_count) { aFree(sd->combos); sd->combos = NULL; sd->combo_count = 0; if( pc->load_combo(sd) > 0 ) status_calc_pc(sd,SCO_FORCE); } + + // Check for and delete unavailable/disabled items. pc->checkitem(sd); } mapit->free(iter); -- cgit v1.2.3-70-g09d2