Fixed slave recalculation on reloadmobdb

Slaves sometimes ended up with weird status calculations or insane speed, because their status got recalculated before their master and this way their speed could not be copied from the master.

Thanks to @Daegaladh
This commit is contained in:
Lemongrass3110 2020-06-02 19:36:49 +02:00
parent 6c5ed52572
commit b10caa039b

View File

@ -5647,6 +5647,20 @@ void mob_reload_itemmob_data(void) {
* @return 0
*/
static int mob_reload_sub( struct mob_data *md, va_list args ){
bool slaves_only = va_arg( args, bool );
if( slaves_only ){
if( md->master_id == 0 ){
// Only slaves should be processed now
return 0;
}
}else{
if( md->master_id != 0 ){
// Slaves will be processed later
return 0;
}
}
// Relink the mob to the new database entry
md->db = mob_db(md->mob_id);
@ -5695,7 +5709,10 @@ static int mob_reload_sub_npc( struct npc_data *nd, va_list args ){
void mob_reload(void) {
do_final_mob(true);
mob_db_load(true);
map_foreachmob(mob_reload_sub);
// First only normal monsters
map_foreachmob( mob_reload_sub, false );
// Then slaves only
map_foreachmob( mob_reload_sub, true );
map_foreachnpc(mob_reload_sub_npc);
}