summaryrefslogtreecommitdiff
path: root/src/map/script.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-01-25 09:43:09 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-01-25 10:14:44 -0800
commit34f0540da418b01dd4d49f6ecf72569d3cfecfdf (patch)
treebf7c4623b0d794e4db8c72b0906bb40807d62ba8 /src/map/script.cpp
parent9a4c3a44476f3306a8deed8a836e8fbc25ceb55f (diff)
downloadtmwa-34f0540da418b01dd4d49f6ecf72569d3cfecfdf.tar.gz
tmwa-34f0540da418b01dd4d49f6ecf72569d3cfecfdf.tar.bz2
tmwa-34f0540da418b01dd4d49f6ecf72569d3cfecfdf.tar.xz
tmwa-34f0540da418b01dd4d49f6ecf72569d3cfecfdf.zip
Implement unified config parsing (mostly)
Diffstat (limited to 'src/map/script.cpp')
-rw-r--r--src/map/script.cpp32
1 files changed, 15 insertions, 17 deletions
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)