Fixed @reloaditemdb @whodrops bug - (bugreport:5084)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15012 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
shennetsind 2011-12-06 03:33:32 +00:00
parent be428f5b9f
commit ef676ae0ec

View File

@ -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) )