Skip to content

Commit b2720ee

Browse files
committed
Update atreloadmob to update living mobs
- fix living mobs aren't updated by latest mob_db upon updated. from rathena/rathena#3783
1 parent a5eb6ec commit b2720ee

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/map/mob.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5547,6 +5547,29 @@ static int mob_final_ratio_sub(union DBKey key, struct DBData *data, va_list ap)
55475547
return 0;
55485548
}
55495549

5550+
static int mob_reload_sub_mob(struct mob_data *md, va_list args)
5551+
{
5552+
nullpo_ret(md);
5553+
md->db = mob_db(md->class_);
5554+
5555+
status_calc_mob(md, SCO_FIRST);
5556+
5557+
// If the view data was not overwritten manually
5558+
if (md->vd != NULL) {
5559+
// Get the new view data from the mob database
5560+
md->vd = mob_get_viewdata(md->class_);
5561+
5562+
// If they are spawned right now
5563+
if (md->bl.prev != NULL) {
5564+
// Respawn all mobs on client side so that they are displayed correctly(if their view id changed)
5565+
clif->clearunit_area(&md->bl, CLR_OUTSIGHT);
5566+
clif->spawn(&md->bl);
5567+
}
5568+
}
5569+
5570+
return 0;
5571+
}
5572+
55505573
static void mob_reload(void)
55515574
{
55525575
int i;
@@ -5570,6 +5593,7 @@ static void mob_reload(void)
55705593
mob->destroy_drop_groups();
55715594

55725595
mob->load(false);
5596+
map->foreachmob(mob->reload_sub_mob);
55735597
}
55745598

55755599
/**
@@ -5726,6 +5750,7 @@ void mob_defaults(void)
57265750

57275751
/* */
57285752
mob->reload = mob_reload;
5753+
mob->reload_sub_mob = mob_reload_sub_mob;
57295754
mob->init = do_init_mob;
57305755
mob->final = do_final_mob;
57315756
/* */

src/map/mob.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ struct mob_interface {
488488
int (*init) (bool mimimal);
489489
int (*final) (void);
490490
void (*reload) (void);
491+
int (*reload_sub_mob) (struct mob_data *md, va_list args);
491492
/* */
492493
struct mob_db* (*db) (int index);
493494
struct mob_chat* (*chat) (short id);

0 commit comments

Comments
 (0)