diff options
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/script.c | 34 | ||||
-rw-r--r-- | src/emap/script.h | 1 |
3 files changed, 36 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index e6e3556..f89829f 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -226,6 +226,7 @@ HPExport void plugin_init (void) 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("script->load_translations", escript_load_translations); addHookPre("status->calc_pc_additional", estatus_calc_pc_additional); addHookPost("clif->getareachar_unit", eclif_getareachar_unit_post); diff --git a/src/emap/script.c b/src/emap/script.c index 74f908e..4b60fe7 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -94,6 +94,40 @@ int escript_reload(void) return 0; } +// stripped copy from script_load_translations without actual translation loading. +void escript_load_translations(void) +{ + if (map->minimal) + { + hookStop(); + return; + } + + script->translation_db = strdb_alloc(DB_OPT_DUP_KEY, NAME_LENGTH * 2 + 1); + + if (script->languages) + { + int i; + for (i = 0; i < script->max_lang_id; i++) + aFree(script->languages[i]); + aFree(script->languages); + } + script->languages = NULL; + script->max_lang_id = 0; + + script->add_language("English"); + + if (script->string_list) + aFree(script->string_list); + + script->string_list = NULL; + script->string_list_pos = 0; + script->string_list_size = 0; + + map->default_lang_id = 0; + hookStop(); +} + 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 af851f7..feae1c0 100644 --- a/src/emap/script.h +++ b/src/emap/script.h @@ -5,6 +5,7 @@ #define EVOL_MAP_SCRIPT int escript_reload(void); +void escript_load_translations(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); |