diff options
author | gumi <git@gumi.ca> | 2020-05-02 09:26:33 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2020-05-03 11:46:22 -0400 |
commit | d958a36388644a9e58b63da0458f836d198833c8 (patch) | |
tree | 31bca949f8fed4901943ff43b0b115cc0ecacfd7 /src/map | |
parent | 06e65c769bbb66045e0d51da6a321a4c4ef1ff42 (diff) | |
download | hercules-d958a36388644a9e58b63da0458f836d198833c8.tar.gz hercules-d958a36388644a9e58b63da0458f836d198833c8.tar.bz2 hercules-d958a36388644a9e58b63da0458f836d198833c8.tar.xz hercules-d958a36388644a9e58b63da0458f836d198833c8.zip |
add a config flag to allow local functions to be public by default
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/script.c | 10 | ||||
-rw-r--r-- | src/map/script.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c index 9d6b9d8a2..6f21f2a82 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2091,8 +2091,12 @@ static const char *parse_syntax(const char *p) script->set_label(l, VECTOR_LENGTH(script->buf), p); return p; } else if( p2 - p == 8 && strncmp(p, "function", 8) == 0 ) { - // local function implicitly marked as private - return script->parse_syntax_function(p2, false); + // local function not marked as public or private + if (script->config.functions_private_by_default) { + return script->parse_syntax_function(p2, false); + } else { + return script->parse_syntax_function(p2, true); + } } break; case 'i': @@ -4968,6 +4972,7 @@ static bool script_config_read(const char *filename, bool imported) libconfig->setting_lookup_bool_real(setting, "warn_func_mismatch_paramnum", &script->config.warn_func_mismatch_paramnum); libconfig->setting_lookup_bool_real(setting, "warn_func_mismatch_argtypes", &script->config.warn_func_mismatch_argtypes); + libconfig->setting_lookup_bool_real(setting, "functions_private_by_default", &script->config.functions_private_by_default); libconfig->setting_lookup_int(setting, "check_cmdcount", &script->config.check_cmdcount); libconfig->setting_lookup_int(setting, "check_gotocount", &script->config.check_gotocount); libconfig->setting_lookup_int(setting, "input_min_value", &script->config.input_min_value); @@ -28570,6 +28575,7 @@ void script_defaults(void) script->config.ontouch_name = "OnTouch_"; //ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves) script->config.ontouch2_name = "OnTouch"; //ontouch2_name (run whenever a char walks into the OnTouch area) script->config.onuntouch_name = "OnUnTouch"; //onuntouch_name (run whenever a char walks from the OnTouch area) + script->config.functions_private_by_default = true; // for ENABLE_CASE_CHECK script->calc_hash_ci = calc_hash_ci; diff --git a/src/map/script.h b/src/map/script.h index 044bcdc42..0a6a21f1b 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -584,6 +584,7 @@ enum itemskill_flag { struct Script_Config { bool warn_func_mismatch_argtypes; bool warn_func_mismatch_paramnum; + bool functions_private_by_default; int check_cmdcount; int check_gotocount; int input_min_value; |