diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-09 01:21:44 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-09 01:47:09 +0530 |
commit | 9841ce45ea91c1ad394d706fd748ffc1fd9d9de0 (patch) | |
tree | 047cbb69276a6b8c55d9b22c1e01442a8bd7d173 /crawl-ref/source/initfile.cc | |
parent | 915b92e5527c1300fa701a31e3dcbc070b48d177 (diff) | |
download | crawl-ref-9841ce45ea91c1ad394d706fd748ffc1fd9d9de0.tar.gz crawl-ref-9841ce45ea91c1ad394d706fd748ffc1fd9d9de0.zip |
Add -script option to Crawl to run a Lua script. Scripts are similar to tests, but can be parameterised.
Add a script to generate 150 level at a named place and report on all the monsters generated there.
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r-- | crawl-ref/source/initfile.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index c3208c425b..f5e0296422 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -3472,6 +3472,7 @@ enum commandline_option_type { CLO_MAPSTAT, CLO_ARENA, CLO_TEST, + CLO_SCRIPT, CLO_BUILDDB, CLO_HELP, CLO_VERSION, @@ -3485,8 +3486,8 @@ enum commandline_option_type { static const char *cmd_ops[] = { "scores", "name", "species", "job", "plain", "dir", "rc", "rcdir", "tscores", "vscores", "scorefile", "morgue", "macro", - "mapstat", "arena", "test", "builddb", "help", "version", "save-version", - "extra-opt-first", "extra-opt-last", + "mapstat", "arena", "test", "script", "builddb", "help", "version", + "save-version", "extra-opt-first", "extra-opt-last" }; const int num_cmd_ops = CLO_NOPS; @@ -3792,6 +3793,21 @@ bool parse_args( int argc, char **argv, bool rc_only ) } break; + case CLO_SCRIPT: + crawl_state.test = true; + crawl_state.script = true; + if (current < argc - 1) + { + crawl_state.tests_selected = split_string(",", next_arg); + for (int extra = current + 2; extra < argc; ++extra) + crawl_state.script_args.push_back(argv[extra]); + current = argc; + } + else + end(1, false, + "-script must specify comma-separated script names"); + break; + case CLO_BUILDDB: if (next_is_param) return (false); |