summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-27 19:29:11 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-27 19:29:11 +0300
commit18757579b1a95e7fdeeaded9e0980ea9b9b65aa2 (patch)
tree3cde5e6f79c1047ff50a504f91719d69ba40ddc1 /src
parent7cbf9606d7da6e452893e446a4099b92dc8bf32e (diff)
downloadevol-hercules-18757579b1a95e7fdeeaded9e0980ea9b9b65aa2.tar.gz
evol-hercules-18757579b1a95e7fdeeaded9e0980ea9b9b65aa2.tar.bz2
evol-hercules-18757579b1a95e7fdeeaded9e0980ea9b9b65aa2.tar.xz
evol-hercules-18757579b1a95e7fdeeaded9e0980ea9b9b65aa2.zip
map: duplicate npc view data for each new npc.
This allow use full npc copies in instances. For duplicate npc untested.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/npc.c12
-rw-r--r--src/emap/npc.h3
4 files changed, 17 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b9812f2..548ab4b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -114,7 +114,7 @@ MAP_SRC = emap/atcommand.c \
# need remove -Wno-unused
-SHARED_CFLAGS = ${CFLAGS} -O3 -pipe -ffast-math -fvisibility=hidden -std=c99 -Wall -Wextra -Wno-sign-compare -Wno-unused \
+SHARED_CFLAGS = ${CFLAGS} -O3 -pipe -ffast-math -fvisibility=hidden -std=c99 -Wall -Wextra -Wno-sign-compare -Wno-unused -fno-omit-frame-pointer \
-DPCRE_SUPPORT -I../../.. -I../../../../3rdparty -DPACKETVER=20150000
SHARED_LDFLAGS = -avoid-version -Wl,--no-undefined
diff --git a/src/emap/init.c b/src/emap/init.c
index fb9da26..a355e2b 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -270,6 +270,7 @@ HPExport void plugin_init (void)
addHookPost(status, calc_speed, estatus_calc_speed_post);
addHookPost(map, addflooritem, emap_addflooritem_post);
addHookPost(mob, read_db_mode_sub, emob_read_db_mode_sub_post);
+ addHookPost(npc, get_viewdata, enpc_get_viewdata_post);
addHookPost(skill, check_condition_castend, eskill_check_condition_castend_post);
addHookPost(pc, additem, epc_additem_post);
addHookPost(pc, isequip, epc_isequip_post);
diff --git a/src/emap/npc.c b/src/emap/npc.c
index 727ea76..9f7ce36 100644
--- a/src/emap/npc.c
+++ b/src/emap/npc.c
@@ -254,6 +254,7 @@ int enpc_unload_pre(struct npc_data** ndPtr,
{
struct npc_data *nd = *ndPtr;
nullpo_ret(nd);
+ aFree(nd->vd);
if (nd->subtype == SCRIPT)
{
if (nd->src_id != 0)
@@ -283,3 +284,14 @@ int enpc_unload_pre(struct npc_data** ndPtr,
}
return 0;
}
+
+struct view_data *enpc_get_viewdata_post(struct view_data *retVal,
+ int class_ __attribute__ ((unused)))
+{
+ nullpo_retr(NULL, retVal);
+
+ struct view_data *vd;
+ CREATE(vd, struct view_data, 1);
+ memcpy(vd, retVal, sizeof(struct view_data));
+ return vd;
+}
diff --git a/src/emap/npc.h b/src/emap/npc.h
index ea6c77f..35d23de 100644
--- a/src/emap/npc.h
+++ b/src/emap/npc.h
@@ -34,4 +34,7 @@ int enpc_get_var_num(const TBL_NPC *const npc,
int enpc_unload_pre(struct npc_data** ndPtr,
bool *singlePtr);
+struct view_data *enpc_get_viewdata_post(struct view_data *retVal,
+ int class_);
+
#endif // EVOL_MAP_NPC