summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-06 03:33:32 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-06 03:33:32 +0000
commit699c9568b18f5860091f5dbea5615b3978f75b11 (patch)
tree156130aa708bf90f079e48b0792c959edf52b1ab /src/map/itemdb.c
parent42f21dfa8d25848945f2e34e230d9baced3270b8 (diff)
downloadhercules-699c9568b18f5860091f5dbea5615b3978f75b11.tar.gz
hercules-699c9568b18f5860091f5dbea5615b3978f75b11.tar.bz2
hercules-699c9568b18f5860091f5dbea5615b3978f75b11.tar.xz
hercules-699c9568b18f5860091f5dbea5615b3978f75b11.zip
Fixed @reloaditemdb @whodrops bug - (bugreport:5084)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15012 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c20
1 files changed, 20 insertions, 0 deletions
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) )