From 51e1c8fd61d0e8270c7502095c73cf58f8beac62 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 7 Nov 2017 19:18:06 +0300 Subject: Update from new hercules. Removed npc vd recreation because it already fixed in hercules. --- src/emap/init.c | 2 -- src/emap/npc.c | 14 ++------------ src/emap/npc.h | 3 --- src/emap/script.c | 12 ++++++------ src/emap/script_buildins.c | 10 +++++----- src/emap/status.c | 15 ++------------- src/emap/status.h | 2 -- 7 files changed, 15 insertions(+), 43 deletions(-) diff --git a/src/emap/init.c b/src/emap/init.c index 8cd7cd4..28aabf8 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -280,7 +280,6 @@ HPExport void plugin_init (void) addHookPre(script, hardcoded_constants, escript_hardcoded_constants_pre); addHookPre(script, run_use_script, escript_run_use_script_pre); addHookPre(status, calc_pc_additional, estatus_calc_pc_additional_pre); - addHookPre(status, set_viewdata, estatus_set_viewdata_pre); addHookPre(homun, gainexp, ehomunculus_gainexp_pre); addHookPost(battle, calc_weapon_attack, ebattle_calc_weapon_attack_post); @@ -310,7 +309,6 @@ HPExport void plugin_init (void) addHookPost(map, addflooritem, emap_addflooritem_post); addHookPost(mob, read_db_mode_sub, emob_read_db_mode_sub_post); addHookPost(mob, spawn_dataset, emob_spawn_dataset_post); - addHookPost(npc, get_viewdata, enpc_get_viewdata_post); addHookPost(skill, check_condition_castend, eskill_check_condition_castend_post); addHookPost(skill, get_index, eskill_get_index_post); addHookPost(pc, additem, epc_additem_post); diff --git a/src/emap/npc.c b/src/emap/npc.c index 0639269..5dee49d 100644 --- a/src/emap/npc.c +++ b/src/emap/npc.c @@ -155,6 +155,8 @@ bool enpc_db_checkid_pre(const int *idPtr) return true; if (id >= MAX_NPC_CLASS2_START && id < MAX_NPC_CLASS2_END) // Second range return true; + if (pc->db_checkid(id)) + return true; // Anything else is invalid return false; } @@ -266,7 +268,6 @@ 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) @@ -295,14 +296,3 @@ 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 35d23de..ea6c77f 100644 --- a/src/emap/npc.h +++ b/src/emap/npc.h @@ -34,7 +34,4 @@ 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 diff --git a/src/emap/script.c b/src/emap/script.c index 5b39e8a..4bc427b 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -145,7 +145,7 @@ void eset_reg_npcscope_num_pre(struct script_state **stPtr, { getExt1(); clif->clearunit_area(&nd->bl, CLR_OUTSIGHT); - nd->vd->sex = *val; + nd->vd.sex = *val; clif->spawn(&nd->bl); hookStop(); } @@ -206,14 +206,14 @@ void eset_reg_npcscope_num_pre(struct script_state **stPtr, else if (!strcmp(name, ".sit")) { getExt1(); - nd->vd->dead_sit = (*val) ? 2 : 0; + nd->vd.dead_sit = (*val) ? 2 : 0; clif->sitting(&nd->bl); hookStop(); } else if (!strcmp(name, ".stand")) { getExt1(); - nd->vd->dead_sit = (*val) ? 0 : 2; + nd->vd.dead_sit = (*val) ? 0 : 2; clif->sitting(&nd->bl); hookStop(); } @@ -258,7 +258,7 @@ int eget_val_npcscope_num_pre(struct script_state **stPtr, { getExt1Return(0); hookStop(); - return nd->vd->sex; + return nd->vd.sex; } else if (!strcmp(name, ".distance")) { @@ -306,13 +306,13 @@ int eget_val_npcscope_num_pre(struct script_state **stPtr, { getExt1Return(0); hookStop(); - return nd->vd->dead_sit == 2 ? 1 : 0; + return nd->vd.dead_sit == 2 ? 1 : 0; } else if (!strcmp(name, ".stand")) { getExt1Return(0); hookStop(); - return nd->vd->dead_sit == 0 ? 1 : 0; + return nd->vd.dead_sit == 0 ? 1 : 0; } else if (!strcmp(name, ".walkmask")) { diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 4c32a9a..b5cd601 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -813,7 +813,7 @@ BUILDIN(setNpcSex) sex = script_getnum(st, 3); } - if (!nd || !nd->vd) + if (!nd) { ShowWarning("npc not found\n"); script->reportsrc(st); @@ -821,7 +821,7 @@ BUILDIN(setNpcSex) } clif->clearunit_area(&nd->bl, CLR_OUTSIGHT); - nd->vd->sex = sex; + nd->vd.sex = sex; clif->spawn(&nd->bl); return true; } @@ -1386,7 +1386,7 @@ BUILDIN(npcSit) script->reportsrc(st); return false; } - nd->vd->dead_sit = 2; + nd->vd.dead_sit = 2; clif->sitting(&nd->bl); return true; } @@ -1416,7 +1416,7 @@ BUILDIN(npcStand) script->reportsrc(st); return false; } - nd->vd->dead_sit = 0; + nd->vd.dead_sit = 0; clif->standing(&nd->bl); return true; } @@ -1440,7 +1440,7 @@ BUILDIN(npcWalkTo) { status_calc_npc(nd, SCO_NONE); } - nd->vd->dead_sit = 0; + nd->vd.dead_sit = 0; script_pushint(st, unit->walktoxy(&nd->bl,x,y,0)); return true; } diff --git a/src/emap/status.c b/src/emap/status.c index 0d60bd2..56ebb2c 100644 --- a/src/emap/status.c +++ b/src/emap/status.c @@ -60,17 +60,6 @@ int estatus_init_post(int retVal, return retVal; } -void estatus_set_viewdata_pre(struct block_list **blPtr, - int *classPtr_ __attribute__ ((unused))) -{ - struct block_list *bl = *blPtr; - if (bl->type != BL_NPC) - return; - TBL_NPC *const npc = (TBL_NPC*)bl; - aFree(npc->vd); - npc->vd = NULL; -} - void estatus_set_viewdata_post(struct block_list *bl, int class_ __attribute__ ((unused))) { @@ -80,10 +69,10 @@ void estatus_set_viewdata_post(struct block_list *bl, return; TBL_NPC *const npc = (TBL_NPC*)bl; struct NpcdExt *data = npcd_get(npc); - if (data && data->init == false && npc->vd) + if (data && data->init == false) { data->init = true; - npc->vd->sex = 3; + npc->vd.sex = 3; if (npc->subtype == SCRIPT) { if (npc->u.scr.script) diff --git a/src/emap/status.h b/src/emap/status.h index 0f78346..11f1695 100644 --- a/src/emap/status.h +++ b/src/emap/status.h @@ -5,8 +5,6 @@ #define EVOL_MAP_STATUS int estatus_init_post(int retVal, bool minimal); -void estatus_set_viewdata_pre(struct block_list **blPtr, - int *classPtr_ __attribute__ ((unused))); void estatus_set_viewdata_post(struct block_list *bl, int class_); void estatus_read_job_db_sub_post(int idx, -- cgit v1.2.3-60-g2f50