summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmistry Haoyan <equinox1991@gmail.com>2019-07-10 02:27:58 +0800
committerEmistry Haoyan <equinox1991@gmail.com>2019-07-10 02:57:27 +0800
commitb2720eebfb21f9334137749cdbac19f4bfc4bc3d (patch)
tree7f4a659c2acaf5556dd81127fe183c0d1ae9f87c
parenta5eb6ec995612c878a3b6cb522520ffae8b13a3b (diff)
downloadhercules-b2720eebfb21f9334137749cdbac19f4bfc4bc3d.tar.gz
hercules-b2720eebfb21f9334137749cdbac19f4bfc4bc3d.tar.bz2
hercules-b2720eebfb21f9334137749cdbac19f4bfc4bc3d.tar.xz
hercules-b2720eebfb21f9334137749cdbac19f4bfc4bc3d.zip
Update atreloadmob to update living mobs
- fix living mobs aren't updated by latest mob_db upon updated. from https://github.com/rathena/rathena/issues/3783
-rw-r--r--src/map/mob.c25
-rw-r--r--src/map/mob.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 8511f8523..404a240c9 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -5547,6 +5547,29 @@ static int mob_final_ratio_sub(union DBKey key, struct DBData *data, va_list ap)
return 0;
}
+static int mob_reload_sub_mob(struct mob_data *md, va_list args)
+{
+ nullpo_ret(md);
+ md->db = mob_db(md->class_);
+
+ status_calc_mob(md, SCO_FIRST);
+
+ // If the view data was not overwritten manually
+ if (md->vd != NULL) {
+ // Get the new view data from the mob database
+ md->vd = mob_get_viewdata(md->class_);
+
+ // If they are spawned right now
+ if (md->bl.prev != NULL) {
+ // Respawn all mobs on client side so that they are displayed correctly(if their view id changed)
+ clif->clearunit_area(&md->bl, CLR_OUTSIGHT);
+ clif->spawn(&md->bl);
+ }
+ }
+
+ return 0;
+}
+
static void mob_reload(void)
{
int i;
@@ -5570,6 +5593,7 @@ static void mob_reload(void)
mob->destroy_drop_groups();
mob->load(false);
+ map->foreachmob(mob->reload_sub_mob);
}
/**
@@ -5726,6 +5750,7 @@ void mob_defaults(void)
/* */
mob->reload = mob_reload;
+ mob->reload_sub_mob = mob_reload_sub_mob;
mob->init = do_init_mob;
mob->final = do_final_mob;
/* */
diff --git a/src/map/mob.h b/src/map/mob.h
index b63efd272..0a7489c47 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -488,6 +488,7 @@ struct mob_interface {
int (*init) (bool mimimal);
int (*final) (void);
void (*reload) (void);
+ int (*reload_sub_mob) (struct mob_data *md, va_list args);
/* */
struct mob_db* (*db) (int index);
struct mob_chat* (*chat) (short id);