summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-14 16:59:50 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-14 16:59:50 +0300
commitf57a705e52b4a21a6e34c93871f689ef971d885f (patch)
tree77e27d52e9a2d9db7188b9bae6823e539203d6a2 /src
parentf03b90ff34e16a5fdd50e3994defffabd088f116 (diff)
downloadevol-hercules-f57a705e52b4a21a6e34c93871f689ef971d885f.tar.gz
evol-hercules-f57a705e52b4a21a6e34c93871f689ef971d885f.tar.bz2
evol-hercules-f57a705e52b4a21a6e34c93871f689ef971d885f.tar.xz
evol-hercules-f57a705e52b4a21a6e34c93871f689ef971d885f.zip
Fix npc assertions on maps with always visible npcs after reload scripts.
Clean npc info stored in plugin data if scripts was reloaded.
Diffstat (limited to 'src')
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/map.c7
-rw-r--r--src/emap/map.h1
-rw-r--r--src/emap/script.c6
-rw-r--r--src/emap/script.h1
5 files changed, 15 insertions, 1 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 53a47df..e6e3556 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -225,6 +225,7 @@ HPExport void plugin_init (void)
addHookPre("script->set_reg_ref_num", eset_reg_npcscope_num);
addHookPre("script->set_reg_npc_str", eset_reg_npcscope_str);
addHookPre("script->set_reg_ref_str", eset_reg_npcscope_str);
+ addHookPre("script->reload", escript_reload);
addHookPre("status->calc_pc_additional", estatus_calc_pc_additional);
addHookPost("clif->getareachar_unit", eclif_getareachar_unit_post);
diff --git a/src/emap/map.c b/src/emap/map.c
index 8f5c54f..7e43f8b 100644
--- a/src/emap/map.c
+++ b/src/emap/map.c
@@ -555,7 +555,7 @@ void map_alwaysVisible_send(TBL_PC *sd)
}
}
-void edo_final_maps(void)
+void map_clear_data(void)
{
int f;
for (f = 0; f < map->count; f++)
@@ -565,3 +565,8 @@ void edo_final_maps(void)
VECTOR_CLEAR(data->npcs);
}
}
+
+void edo_final_maps(void)
+{
+ map_clear_data();
+}
diff --git a/src/emap/map.h b/src/emap/map.h
index 1813d57..6906af3 100644
--- a/src/emap/map.h
+++ b/src/emap/map.h
@@ -44,5 +44,6 @@ void map_alwaysVisible_delete(const struct block_list *bl);
bool map_alwaysVisible_find(const struct block_list *bl);
void map_alwaysVisible_send(TBL_PC *sd);
void edo_final_maps(void);
+void map_clear_data(void);
#endif // EVOL_MAP_MAP
diff --git a/src/emap/script.c b/src/emap/script.c
index e323e20..74f908e 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -88,6 +88,12 @@
extern int mountScriptId;
+int escript_reload(void)
+{
+ map_clear_data();
+ return 0;
+}
+
void eset_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 *num, const char* name, int *val)
{
if (!strcmp(name, ".lang"))
diff --git a/src/emap/script.h b/src/emap/script.h
index 534eb82..af851f7 100644
--- a/src/emap/script.h
+++ b/src/emap/script.h
@@ -4,6 +4,7 @@
#ifndef EVOL_MAP_SCRIPT
#define EVOL_MAP_SCRIPT
+int escript_reload(void);
void eset_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 *num, const char* name, int *val);
int eget_val_npcscope_num(struct script_state* st, struct reg_db *n, struct script_data* data);
void eset_reg_npcscope_str(struct script_state* st, struct reg_db *n, int64 *num, const char* name, const char *str);