From 699c9568b18f5860091f5dbea5615b3978f75b11 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 6 Dec 2011 03:33:32 +0000 Subject: Fixed @reloaditemdb @whodrops bug - (bugreport:5084) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15012 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/itemdb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/map/itemdb.c') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 00d4176c5..cbe462db9 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1093,6 +1093,21 @@ void itemdb_reload(void) struct map_session_data* sd; int i; + /** + * [Ind] The following fixes the @reloaditemdb issue that'd clear the mob-dropped data (which is populated by mob_db stuff) + * - It saves the data before it is refreshed in this array, and quickly re-populates it with this same data after refresh is done. + **/ + struct { + struct { + unsigned short chance; + int id; + } mob[MAX_SEARCH]; + } temporaryMonsterDrop[MAX_ITEMDB]; + + // [Ind] capture the existent temporaryMonsterDrop data + for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) + if( itemdb_array[i] ) + memcpy(&temporaryMonsterDrop[i].mob, &itemdb_array[i]->mob, sizeof(itemdb_array[i]->mob)); // clear the previous itemdb data for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) @@ -1106,6 +1121,11 @@ void itemdb_reload(void) // read new data itemdb_read(); + // [Ind] re-populate the temporaryMonsterDrop data + for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) + if( itemdb_array[i] ) + memcpy(&itemdb_array[i]->mob, &temporaryMonsterDrop[i].mob, sizeof(temporaryMonsterDrop[i].mob)); + // readjust itemdb pointer cache for each player iter = mapit_geteachpc(); for( sd = (struct map_session_data*)mapit_first(iter); mapit_exists(iter); sd = (struct map_session_data*)mapit_next(iter) ) -- cgit v1.2.3-60-g2f50