From 34f0540da418b01dd4d49f6ecf72569d3cfecfdf Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 25 Jan 2014 09:43:09 -0800 Subject: Implement unified config parsing (mostly) --- src/map/script.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'src/map/script.cpp') diff --git a/src/map/script.cpp b/src/map/script.cpp index e947208..51f228f 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -16,6 +16,7 @@ #include "../io/lock.hpp" #include "../io/read.hpp" +#include "../common/config_parse.hpp" #include "../common/core.hpp" #include "../common/db.hpp" #include "../common/extract.hpp" @@ -89,13 +90,20 @@ const char *pos_str[11] = static struct Script_Config { - int warn_func_no_comma; - int warn_cmd_no_comma; - int warn_func_mismatch_paramnum; - int warn_cmd_mismatch_paramnum; - int check_cmdcount; - int check_gotocount; + static const + int warn_func_no_comma = 1; + static const + int warn_cmd_no_comma = 1; + static const + int warn_func_mismatch_paramnum = 1; + static const + int warn_cmd_mismatch_paramnum = 1; + static const + int check_cmdcount = 8192; + static const + int check_gotocount = 512; } script_config; + static int parse_cmd_if = 0; static @@ -698,7 +706,7 @@ void read_constdb(void) FString line; while (in.getline(line)) { - if (line.startswith("//")) + if (is_comment(line)) continue; FString name; @@ -5001,16 +5009,6 @@ void script_autosave_mapreg(TimerData *, tick_t) script_save_mapreg(); } -void script_config_read() -{ - script_config.warn_func_no_comma = 1; - script_config.warn_cmd_no_comma = 1; - script_config.warn_func_mismatch_paramnum = 1; - script_config.warn_cmd_mismatch_paramnum = 1; - script_config.check_cmdcount = 8192; - script_config.check_gotocount = 512; -} - void do_final_script(void) { if (mapreg_dirty >= 0) -- cgit v1.2.3-70-g09d2