23 #include <boost/any.hpp> 24 #include <boost/program_options/cmdline.hpp> 25 #include <boost/program_options/errors.hpp> 26 #include <boost/program_options/parsers.hpp> 27 #include <boost/program_options/positional_options.hpp> 28 #include <boost/program_options/value_semantic.hpp> 29 #include <boost/program_options/variables_map.hpp> 34 namespace po = boost::program_options;
36 class two_strings :
public std::pair<std::string,std::string> {};
38 static void validate(boost::any& v,
const std::vector<std::string>& values,
42 if (values.size() != 2) {
43 throw po::validation_error(po::validation_error::invalid_option_value);
45 ret_val.first = values.at(0);
46 ret_val.second = values.at(1);
52 <<
"\" (WIDTHxHEIGHT expected)")
57 const std::string& expected_format)
59 <<
"\" (" << expected_format <<
" expected)")
65 #define IMPLY_WCONSOLE " Implies --wconsole." 67 #define IMPLY_WCONSOLE 75 , campaign_difficulty()
77 , campaign_skip_story(false)
85 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
99 , log_precise_timestamps(false)
101 , multiplayer_ai_config()
102 , multiplayer_algorithm()
103 , multiplayer_controller()
105 , multiplayer_exit_at_end()
106 , multiplayer_ignore_map_settings()
107 , multiplayer_label()
109 , multiplayer_repeat()
110 , multiplayer_scenario()
112 , multiplayer_turns()
123 , preprocess_defines()
124 , preprocess_input_macros()
125 , preprocess_output_macros()
127 , preprocess_target()
136 , screenshot_map_file()
137 , screenshot_output_file()
140 , script_unsafe_mode(false)
141 , strict_validation(false)
144 , headless_unit_test(false)
145 , noreplaycheck(false)
147 , userconfig_path(false)
149 , userdata_path(false)
152 , validate_core(false)
165 , translation_percent()
166 , args_(args.begin() + 1, args.end())
167 , args0_(*args.begin())
174 po::options_description general_opts(
"General options");
175 general_opts.add_options()
176 (
"all-translations",
"Show all translations, even incomplete ones.")
177 (
"bunzip2", po::value<std::string>(),
"decompresses a file (<arg>.bz2) in bzip2 format and stores it without the .bz2 suffix. <arg>.bz2 will be removed.")
178 (
"bzip2", po::value<std::string>(),
"compresses a file (<arg>) in bzip2 format, stores it as <arg>.bz2 and removes <arg>.")
179 (
"clock",
"Adds the option to show a clock for testing the drawing timer.")
180 (
"config-dir", po::value<std::string>(),
"sets the path of the userdata directory to $HOME/<arg> or My Documents\\My Games\\<arg> for Windows. You can specify also an absolute path outside the $HOME or My Documents\\My Games directory. DEPRECATED: use userdata-dir instead.")
181 (
"config-path",
"prints the path of the userdata directory and exits. DEPRECATED: use userdata-path instead.")
182 (
"core", po::value<std::string>(),
"overrides the loaded core with the one whose id is specified.")
183 (
"data-dir", po::value<std::string>(),
"overrides the data directory with the one specified.")
184 (
"data-path",
"prints the path of the data directory and exits." IMPLY_WCONSOLE)
185 (
"debug,d",
"enables additional command mode options in-game.")
186 (
"debug-lua",
"enables some Lua debugging mechanisms")
187 (
"strict-lua",
"disallow deprecated Lua API calls")
188 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
189 (
"debug-dot-level", po::value<std::string>(),
"sets the level of the debug dot files. <arg> should be a comma separated list of levels. These files are used for debugging the widgets especially the for the layout engine. When enabled the engine will produce dot files which can be converted to images with the dot tool. Available levels: size (generate the size info of the widget), state (generate the state info of the widget).")
190 (
"debug-dot-domain", po::value<std::string>(),
"sets the domain of the debug dot files. <arg> should be a comma separated list of domains. See --debug-dot-level for more info. Available domains: show (generate the data when the dialog is about to be shown), layout (generate the data during the layout phase - might result in multiple files). The data can also be generated when the F12 is pressed in a dialog.")
192 (
"editor,e", po::value<std::string>()->implicit_value(std::string()),
"starts the in-game map editor directly. If file <arg> is specified, equivalent to -e --load <arg>.")
193 (
"gunzip", po::value<std::string>(),
"decompresses a file (<arg>.gz) in gzip format and stores it without the .gz suffix. <arg>.gz will be removed.")
194 (
"gzip", po::value<std::string>(),
"compresses a file (<arg>) in gzip format, stores it as <arg>.gz and removes <arg>.")
196 (
"language,L", po::value<std::string>(),
"uses language <arg> (symbol) this session. Example: --language ang_GB@latin")
197 (
"load,l", po::value<std::string>(),
"loads the save <arg> from the standard save game directory. When launching the map editor via -e, the map <arg> is loaded, relative to the current directory. If it is a directory, the editor will start with a load map dialog opened there.")
198 (
"noaddons",
"disables the loading of all add-ons.")
199 (
"nocache",
"disables caching of game data.")
200 (
"nodelay",
"runs the game without any delays.")
201 (
"nomusic",
"runs the game without music.")
202 (
"nosound",
"runs the game without sounds and music.")
203 (
"password", po::value<std::string>(),
"uses <password> when connecting to a server, ignoring other preferences.")
204 (
"plugin", po::value<std::string>(),
"(experimental) load a script which defines a wesnoth plugin. similar to --script below, but Lua file should return a function which will be run as a coroutine and periodically woken up with updates.")
205 (
"render-image", po::value<two_strings>()->multitoken(),
"takes two arguments: <image> <output>. Like screenshot, but instead of a map, takes a valid Wesnoth 'image path string' with image path functions, and writes it to a .png file." IMPLY_WCONSOLE)
206 (
"report,R",
"initializes game directories, prints build information suitable for use in bug reports, and exits." IMPLY_WCONSOLE)
207 (
"rng-seed", po::value<unsigned int>(),
"seeds the random number generator with number <arg>. Example: --rng-seed 0")
208 (
"screenshot", po::value<two_strings>()->multitoken(),
"takes two arguments: <map> <output>. Saves a screenshot of <map> to <output> without initializing a screen. Editor must be compiled in for this to work." IMPLY_WCONSOLE)
209 (
"script", po::value<std::string>(),
"(experimental) file containing a Lua script to control the client")
210 (
"server,s", po::value<std::string>()->implicit_value(std::string()),
"connects to the host <arg> if specified or to the first host in your preferences.")
211 (
"strict-validation",
"makes validation errors fatal")
212 (
"translations-over", po::value<unsigned int>(),
"Specify the standard for determining whether a translation is complete.")
213 (
"unsafe-scripts",
"makes the \'package\' package available to Lua scripts, so that they can load arbitrary packages. Do not do this with untrusted scripts! This action gives ua the same permissions as the Wesnoth executable.")
214 (
"userconfig-dir", po::value<std::string>(),
"sets the path of the user config directory to $HOME/<arg> or My Documents\\My Games\\<arg> for Windows. You can specify also an absolute path outside the $HOME or My Documents\\My Games directory. Defaults to $HOME/.config/wesnoth on X11 and to the userdata-dir on other systems.")
215 (
"userconfig-path",
"prints the path of the user config directory and exits.")
216 (
"userdata-dir", po::value<std::string>(),
"sets the path of the userdata directory to $HOME/<arg> or My Documents\\My Games\\<arg> for Windows. You can specify also an absolute path outside the $HOME or My Documents\\My Games directory.")
217 (
"userdata-path",
"prints the path of the userdata directory and exits." IMPLY_WCONSOLE)
218 (
"username", po::value<std::string>(),
"uses <username> when connecting to a server, ignoring other preferences.")
219 (
"validcache",
"assumes that the cache is valid. (dangerous)")
220 (
"version,v",
"prints the game's version number and exits.")
221 (
"with-replay",
"replays the file loaded with the --load option.")
223 (
"wconsole",
"attaches a console window on startup (Windows only). Implied by any option that prints something and exits.")
224 (
"wnoconsole",
"don't attach a console window on startup (Windows only). Overrides options that imply --wconsole.")
225 (
"wnoredirect",
"disables standard redirection of logging to a file (Windows only), allowing the output to be piped to another command")
229 po::options_description campaign_opts(
"Campaign options");
230 campaign_opts.add_options()
231 (
"campaign,c", po::value<std::string>()->implicit_value(std::string()),
"goes directly to the campaign with id <arg>. A selection menu will appear if no id was specified.")
232 (
"campaign-difficulty", po::value<int>(),
"The difficulty of the specified campaign (1 to max). If none specified, the campaign difficulty selection widget will appear.")
233 (
"campaign-scenario", po::value<std::string>(),
"The id of the scenario from the specified campaign. The default is the first scenario.")
234 (
"campaign-skip-story",
"Skip [story] tags of the specified campaign.")
237 po::options_description display_opts(
"Display options");
238 display_opts.add_options()
239 (
"fps",
"displays the number of frames per second the game is currently running at, in a corner of the screen. Min/avg/max don't take the FPS limiter into account, act does.")
240 (
"fullscreen,f",
"runs the game in full screen mode.")
241 (
"max-fps", po::value<int>(),
"the maximum fps the game tries to run at. Values should be between 1 and 1000, the default is the display's refresh rate.")
242 (
"new-widgets",
"there is a new WIP widget toolkit this switch enables the new toolkit (VERY EXPERIMENTAL don't file bug reports since most are known). Parts of the library are deemed stable and will work without this switch.")
243 (
"resolution,r", po::value<std::string>(),
"sets the screen resolution. <arg> should have format XxY. Example: --resolution 800x600")
244 (
"windowed,w",
"runs the game in windowed mode.")
247 po::options_description logging_opts(
"Logging options");
248 logging_opts.add_options()
249 (
"logdomains", po::value<std::string>()->implicit_value(std::string()),
"lists defined log domains (only the ones containing <arg> filter if such is provided) and exits." IMPLY_WCONSOLE)
250 (
"log-error", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'error'. <arg> should be given as a comma-separated list of domains, wildcards are allowed. Example: --log-error=network,gui/*,engine/enemies")
251 (
"log-warning", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'warning'. Similar to --log-error.")
252 (
"log-info", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'info'. Similar to --log-error.")
253 (
"log-debug", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'debug'. Similar to --log-error.")
254 (
"log-none", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'none'. Similar to --log-error.")
255 (
"log-precise",
"shows the timestamps in log output with more precision.")
258 po::options_description multiplayer_opts(
"Multiplayer options");
259 multiplayer_opts.add_options()
260 (
"multiplayer,m",
"Starts a multiplayer game. There are additional options that can be used as explained below:")
261 (
"ai-config", po::value<std::vector<std::string>>()->composing(),
"selects a configuration file to load for this side. <arg> should have format side:value")
262 (
"algorithm", po::value<std::vector<std::string>>()->composing(),
"selects a non-standard algorithm to be used by the AI controller for this side. <arg> should have format side:value")
263 (
"controller", po::value<std::vector<std::string>>()->composing(),
"selects the controller for this side. <arg> should have format side:value")
264 (
"era", po::value<std::string>(),
"selects the era to be played in by its id.")
265 (
"exit-at-end",
"exit Wesnoth at the end of the scenario.")
266 (
"ignore-map-settings",
"do not use map settings.")
267 (
"label", po::value<std::string>(),
"sets the label for AIs.")
268 (
"multiplayer-repeat", po::value<unsigned int>(),
"repeats a multiplayer game after it is finished <arg> times.")
269 (
"nogui",
"runs the game without the GUI.")
270 (
"parm", po::value<std::vector<std::string>>()->composing(),
"sets additional parameters for this side. <arg> should have format side:name:value.")
271 (
"scenario", po::value<std::string>(),
"selects a multiplayer scenario. The default scenario is \"multiplayer_The_Freelands\".")
272 (
"side", po::value<std::vector<std::string>>()->composing(),
"selects a faction of the current era for this side by id. <arg> should have format side:value.")
273 (
"turns", po::value<std::string>(),
"sets the number of turns. By default no turn limit is set.")
276 po::options_description testing_opts(
"Testing options");
277 testing_opts.add_options()
278 (
"test,t", po::value<std::string>()->implicit_value(std::string()),
"runs the game in a small test scenario. If specified, scenario <arg> will be used instead.")
279 (
"unit,u", po::value<std::vector<std::string>>(),
"runs a unit test scenario. The GUI is not shown and the exit code of the program reflects the victory / defeat conditions of the scenario.\n\t0 - PASS\n\t1 - FAIL\n\t3 - FAIL (INVALID REPLAY)\n\t4 - FAIL (ERRORED REPLAY)\n\t5 - FAIL (BROKE STRICT)\n\t6 - FAIL (WML EXCEPTION)\n\tMultiple tests can be run by giving this option multiple times, in this case the test run will stop immediately after any test which doesn't PASS and the return code will be the status of the test that caused the stop.")
280 (
"showgui",
"don't run headlessly (for debugging a failing test)")
281 (
"log-strict", po::value<std::string>(),
"sets the strict level of the logger. any messages sent to log domains of this level or more severe will cause the unit test to fail regardless of the victory result.")
282 (
"nobanner",
"suppress startup banner.")
283 (
"noreplaycheck",
"don't try to validate replay of unit test.")
284 (
"mp-test",
"load the test mp scenarios.")
287 po::options_description parsing_opts(
"WML parsing options");
288 parsing_opts.add_options()
289 (
"use-schema,S", po::value<std::string>(),
"specify a schema to validate WML against (defaults to the core schema)")
290 (
"validate,V", po::value<std::string>(),
"validate a specified WML file against a schema" IMPLY_WCONSOLE)
291 (
"validate-addon", po::value<std::string>(),
"validate the specified addon's WML against the schema. Requires the user to play the campaign (in the GUI) to trigger the validation.")
292 (
"validate-core",
"validate the core WML against the schema")
293 (
"validate-schema", po::value<std::string>(),
"validate a specified WML schema" IMPLY_WCONSOLE)
294 (
"diff,D", po::value<two_strings>()->multitoken(),
"diff two preprocessed WML documents" IMPLY_WCONSOLE)
295 (
"output,o", po::value<std::string>(),
"output to specified file")
296 (
"patch,P", po::value<two_strings>()->multitoken(),
"apply a patch to a preprocessed WML document" IMPLY_WCONSOLE)
297 (
"preprocess,p", po::value<two_strings>()->multitoken(),
"requires two arguments: <file/folder> <target directory>. Preprocesses a specified file/folder. The preprocessed file(s) will be written in the specified target directory: a plain cfg file and a processed cfg file." IMPLY_WCONSOLE)
298 (
"preprocess-defines", po::value<std::string>(),
"comma separated list of defines to be used by '--preprocess' command. If 'SKIP_CORE' is in the define list the data/core won't be preprocessed. Example: --preprocess-defines=FOO,BAR")
299 (
"preprocess-input-macros", po::value<std::string>(),
"used only by the '--preprocess' command. Specifies source file <arg> that contains [preproc_define]s to be included before preprocessing.")
300 (
"preprocess-output-macros", po::value<std::string>()->implicit_value(std::string()),
"used only by the '--preprocess' command. Will output all preprocessed macros in the target file <arg>. If the file is not specified the output will be file '_MACROS_.cfg' in the target directory of preprocess's command.")
306 visible_.add(general_opts).add(campaign_opts).add(display_opts).add(logging_opts).add(multiplayer_opts).add(testing_opts).add(parsing_opts);
310 po::positional_options_description positional;
311 positional.add(
"data-dir",1);
313 po::variables_map vm;
314 const int parsing_style = po::command_line_style::default_style ^ po::command_line_style::allow_guessing;
315 po::store(po::command_line_parser(
args_).
options(
all_).positional(positional).style(parsing_style).run(),vm);
317 if (vm.count(
"ai-config"))
319 if (vm.count(
"algorithm"))
321 if (vm.count(
"bunzip2"))
322 bunzip2 = vm[
"bunzip2"].as<std::string>();
323 if (vm.count(
"bzip2"))
324 bzip2 = vm[
"bzip2"].as<std::string>();
325 if (vm.count(
"campaign"))
326 campaign = vm[
"campaign"].as<std::string>();
327 if (vm.count(
"campaign-difficulty"))
329 if (vm.count(
"campaign-scenario"))
331 if (vm.count(
"campaign-skip-story"))
333 if (vm.count(
"clock"))
335 if (vm.count(
"core"))
336 core_id = vm[
"core"].as<std::string>();
337 if (vm.count(
"config-dir"))
339 if (vm.count(
"config-path"))
341 if (vm.count(
"controller"))
343 if (vm.count(
"data-dir"))
344 data_dir = vm[
"data-dir"].as<std::string>();
345 if (vm.count(
"data-path"))
347 if (vm.count(
"debug"))
349 if (vm.count(
"debug-lua"))
351 if (vm.count(
"strict-lua"))
353 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS 354 if (vm.count(
"debug-dot-domain")) {
355 debug_dot_domain = vm[
"debug-dot-domain"].as<std::string>();
357 if (vm.count(
"debug-dot-level")) {
358 debug_dot_level = vm[
"debug-dot-level"].as<std::string>();
361 if (vm.count(
"editor"))
362 editor = vm[
"editor"].as<std::string>();
365 if (vm.count(
"exit-at-end"))
369 if (vm.count(
"fullscreen"))
371 if (vm.count(
"gunzip"))
372 gunzip = vm[
"gunzip"].as<std::string>();
373 if (vm.count(
"gzip"))
374 gzip = vm[
"gzip"].as<std::string>();
375 if (vm.count(
"help"))
377 if (vm.count(
"ignore-map-settings"))
379 if (vm.count(
"label"))
381 if (vm.count(
"language"))
382 language = vm[
"language"].as<std::string>();
383 if (vm.count(
"load"))
384 load = vm[
"load"].as<std::string>();
385 if (vm.count(
"log-error"))
387 if (vm.count(
"log-warning"))
389 if (vm.count(
"log-info"))
391 if (vm.count(
"log-debug"))
393 if (vm.count(
"log-none"))
395 if (vm.count(
"logdomains"))
396 logdomains = vm[
"logdomains"].as<std::string>();
397 if (vm.count(
"log-precise"))
399 if (vm.count(
"log-strict"))
401 if (vm.count(
"max-fps"))
402 max_fps = vm[
"max-fps"].as<int>();
403 if (vm.count(
"mp-test"))
405 if (vm.count(
"multiplayer"))
407 if (vm.count(
"multiplayer-repeat"))
409 if (vm.count(
"new-widgets"))
411 if (vm.count(
"noaddons"))
413 if (vm.count(
"nocache"))
415 if (vm.count(
"nodelay"))
417 if (vm.count(
"nomusic"))
419 if (vm.count(
"noreplaycheck"))
421 if (vm.count(
"nosound"))
423 if (vm.count(
"nogui"))
425 if (vm.count(
"nobanner"))
427 if (vm.count(
"parm"))
429 if (vm.count(
"preprocess"))
435 if (vm.count(
"diff"))
441 if (vm.count(
"patch"))
447 if (vm.count(
"output"))
451 if (vm.count(
"preprocess-defines"))
453 if (vm.count(
"preprocess-input-macros"))
455 if (vm.count(
"preprocess-output-macros"))
457 if (vm.count(
"resolution"))
459 if (vm.count(
"rng-seed"))
460 rng_seed = vm[
"rng-seed"].as<unsigned int>();
461 if (vm.count(
"scenario"))
463 if (vm.count(
"render-image"))
468 if (vm.count(
"screenshot"))
474 if (vm.count(
"script"))
476 if (vm.count(
"unsafe-scripts"))
478 if (vm.count(
"plugin"))
480 if (vm.count(
"server"))
481 server = vm[
"server"].as<std::string>();
482 if (vm.count(
"username"))
483 username = vm[
"username"].as<std::string>();
484 if (vm.count(
"password"))
485 password = vm[
"password"].as<std::string>();
486 if (vm.count(
"report"))
488 if (vm.count(
"side"))
490 if (vm.count(
"test"))
491 test = vm[
"test"].as<std::string>();
492 if (vm.count(
"unit"))
494 unit_test = vm[
"unit"].as<std::vector<std::string>>();
497 if (vm.count(
"showgui"))
499 if (vm.count(
"noreplaycheck"))
501 if (vm.count(
"turns"))
503 if (vm.count(
"strict-validation"))
505 if (vm.count(
"userconfig-dir"))
507 if (vm.count(
"userconfig-path"))
509 if (vm.count(
"userdata-dir"))
511 if (vm.count(
"userdata-path"))
513 if (vm.count(
"validcache"))
516 if (vm.count(
"validate"))
518 if (vm.count(
"validate-core"))
520 if (vm.count(
"validate-addon"))
522 if (vm.count(
"validate-schema"))
525 if (vm.count(
"use-schema"))
527 if (vm.count(
"version"))
529 if (vm.count(
"windowed"))
531 if (vm.count(
"with-replay"))
533 if(vm.count(
"all-translations"))
535 else if(vm.count(
"translations-over"))
536 translation_percent = std::clamp<unsigned int>(vm[
"translations-over"].as<unsigned int>(), 0, 100);
542 for (
const std::string& domain : domains)
545 log = std::vector<std::pair<int, std::string>>();
546 log->emplace_back(severity, domain);
553 if (severity == l->get_name()) {
558 std::cerr <<
"Unrecognized argument to --log-strict : " << severity <<
" . \nDisabling strict mode logging." << std::endl;
564 const std::vector<std::string> tokens =
utils::split(resolution_string,
'x');
565 if (tokens.size() != 2) {
572 xres = std::stoi(tokens[0]);
573 yres = std::stoi(tokens[1]);
574 }
catch(
const std::invalid_argument &) {
583 std::vector<std::pair<unsigned int,std::string>> vec;
584 const std::string& expected_format
585 = std::string() +
"UINT" + separator +
"STRING";
587 for (
const std::string &
s : strings)
589 const std::vector<std::string> tokens =
utils::split(
s, separator);
590 if(tokens.size() != 2) {
601 vec.emplace_back(temp, tokens[1]);
608 std::vector<std::tuple<unsigned int,std::string,std::string>> vec;
609 const std::string& expected_format
610 = std::string() +
"UINT" + separator +
"STRING" + separator +
"STRING";
612 for (
const std::string &
s : strings)
614 const std::vector<std::string> tokens =
utils::split(
s, separator);
615 if(tokens.size() != 3) {
626 vec.emplace_back(temp, tokens[1], tokens[2]);
633 os <<
"Usage: " << cmdline_opts.
args0_ <<
" [<options>] [<data-directory>]\n";
bool log_precise_timestamps
True if –log-precise was given on the command line.
bool new_widgets
Do we wish to use the new library or not.
std::vector< std::string > args_
std::optional< std::string > preprocess_path
Path to parse that was given to the –preprocess option.
std::optional< std::string > output_file
Output filename for WML diff or preprocessing.
std::optional< std::string > core_id
Non-empty if –core was given on the command line.
bool any_validation_option() const
True if the –validate or any of the –validate-* options are given.
std::optional< std::string > preprocess_output_macros
Non-empty if –preprocess-output-macros was given on the command line.
bool mptest
True if –mp-test was given on the command line.
static domain_map * domains
boost::program_options::options_description all_
bool nogui
True if –nogui was given on the command line.
bool script_unsafe_mode
Whether to load the "package" package for the scripting environment.
std::optional< std::string > test
Non-empty if –test was given on the command line.
std::optional< std::vector< std::pair< unsigned int, std::string > > > multiplayer_ai_config
Non-empty if –ai-config was given on the command line.
std::vector< game_tip > load(const config &cfg)
Loads the tips from a config.
commandline_options(const std::vector< std::string > &args)
std::vector< std::tuple< unsigned int, std::string, std::string > > parse_to_uint_string_string_tuples_(const std::vector< std::string > &strings, char separator=':')
A helper function splitting vector of strings of format unsigned int:string:string to vector of tuple...
std::optional< std::string > password
Non-empty if –password was given on the command line.
boost::program_options::options_description hidden_
static l_noret error(LoadState *S, const char *why)
bool noaddons
True if –noaddons was given on the command line.
std::optional< unsigned int > translation_percent
Non-empty if –all-translations or –translations-over is given on the command line.
New lexcical_cast header.
void parse_log_domains_(const std::string &domains_string, const int severity)
bool userdata_path
True if –userdata-path was given on the command line.
bool multiplayer_ignore_map_settings
True if –ignore-map-settings was given at the command line.
std::optional< std::string > preprocess_target
Target (output) path that was given to the –preprocess option.
std::optional< std::string > preprocess_input_macros
Non-empty if –preprocess-input-macros was given on the command line.
std::optional< std::string > multiplayer_label
Non-empty if –label was given on the command line.
std::optional< std::vector< std::tuple< unsigned int, std::string, std::string > > > multiplayer_parm
Non-empty if –parm was given on the command line.
std::optional< std::string > userconfig_dir
Non-empty if –userconfig-dir was given on the command line.
bool fps
True if –fps was given on the command line.
std::vector< std::string > unit_test
Non-empty if –unit was given on the command line.
bool noreplaycheck
True if –noreplaycheck was given on the command line.
std::optional< std::string > load
Non-empty if –load was given on the command line.
std::optional< int > max_fps
Max FPS specified by –max-fps option.
void parse_resolution_(const std::string &resolution_string)
To lexical_cast(From value)
Lexical cast converts one type to another.
Definitions for the interface to Wesnoth Markup Language (WML).
bad_commandline_tuple(const std::string &str, const std::string &expected_format)
std::string diff_left
Files for diffing or patching.
bool preprocess
True if –preprocess was given on the command line.
bool with_replay
True if –with-replay was given on the command line.
bool headless_unit_test
True if –unit is used and –showgui is not present.
std::optional< std::string > render_image_dst
Output file to put rendered image path in.
bool report
True if –report was given on the command line.
std::optional< std::string > gzip
Non-empty if –gzip was given on the command line.
bool nodelay
True if –nodelay was given on the command line.
std::optional< unsigned int > rng_seed
RNG seed specified by –rng-seed option.
std::optional< std::vector< std::pair< int, std::string > > > log
Contains parsed arguments of –log-* (e.g.
std::optional< std::string > validate_addon
Non-empty if –validate-addon was given on the command line.
std::optional< int > campaign_difficulty
Non-empty if –campaign-difficulty was given on the command line.
bool windowed
True if –windowed was given on the command line.
std::optional< std::string > bunzip2
Non-empty if –bunzip2 was given on the command line.
std::vector< std::pair< unsigned int, std::string > > parse_to_uint_string_tuples_(const std::vector< std::string > &strings, char separator=':')
A helper function splitting vector of strings of format unsigned int:string to vector of tuples (unsi...
bool multiplayer
True if –multiplayer was given on the command line.
std::optional< std::vector< std::pair< unsigned int, std::string > > > multiplayer_algorithm
Non-empty if –algorithm was given on the command line.
Manage the empty-palette in the editor.
bool clock
True if –clock was given on the command line.
bool userconfig_path
True if –userconfig-path was given on the command line.
std::optional< std::string > bzip2
Non-empty if –bzip2 was given on the command line.
bool nobanner
True if –nobanner was given on the command line.
std::optional< std::string > logdomains
Non-empty if –logdomains was given on the command line.
std::optional< std::string > render_image
Image path to render.
bool nomusic
True if –nomusic was given on the command line.
std::optional< std::string > multiplayer_era
Non-empty if –era was given on the command line.
std::optional< std::string > campaign
Non-empty if –campaign was given on the command line.
bool debug
True if –debug was given on the command line.
bool debug_lua
True if –debug-lua was given in the commandline.
bool nocache
True if –nocache was given on the command line.
void set_strict_severity(int severity)
bool strict_lua
True if –strict-lua was given in the commandline.
bool new_widgets
True if –new-widgets was given on the command line.
std::optional< std::string > screenshot_output_file
Output file to put screenshot in.
std::optional< std::string > gunzip
Non-empty if –gunzip was given on the command line.
std::optional< std::vector< std::pair< unsigned int, std::string > > > multiplayer_side
Non-empty if –side was given on the command line.
static map_location::DIRECTION s
std::string password(const std::string &server, const std::string &login)
std::optional< std::string > userdata_dir
Non-empty if –userdata-dir was given on the command line.
bad_commandline_resolution(const std::string &resolution)
static void validate(boost::any &v, const std::vector< std::string > &values, two_strings *, int)
std::optional< std::string > script_file
File to load lua script from.
std::optional< std::string > username
Non-empty if –username was given on the command line.
std::optional< std::string > data_dir
Non-empty if –data-dir was given on the command line.
std::optional< std::string > multiplayer_scenario
Non-empty if –scenario was given on the command line.
bool campaign_skip_story
True if –skip-story was given on the command line.
void parse_log_strictness(const std::string &severity)
std::optional< std::string > server
Non-empty if –server was given on the command line.
bool data_path
True if –data-path was given on the command line.
bool screenshot
True if –screenshot was given on the command line.
std::vector< std::string > split(const config_attribute_value &val)
bool version
True if –version was given on the command line.
bool validate_core
True if –validate-core was given on the command line.
std::optional< std::string > screenshot_map_file
Map file to make a screenshot of.
Standard logging facilities (interface).
std::optional< std::string > validate_with
Non-empty if –use-schema was given on the command line.
std::optional< std::string > validate_wml
Non-empty if –validate was given on the command line.
bool fullscreen
True if –fullscreen was given on the command line.
bool validcache
True if –validcache was given on the command line.
bool strict_validation
True if –strict-validation was given on the command line.
std::optional< std::string > multiplayer_turns
Non-empty if –turns was given on the command line.
std::optional< std::vector< std::string > > preprocess_defines
Defines that were given to the –preprocess option.
std::optional< unsigned int > multiplayer_repeat
Repeats specified by –multiplayer-repeat option.
bool nosound
True if –nosound was given on the command line.
std::optional< std::vector< std::pair< unsigned int, std::string > > > multiplayer_controller
Non-empty if –controller was given on the command line.
boost::program_options::options_description visible_
friend std::ostream & operator<<(std::ostream &os, const commandline_options &cmdline_opts)
To be used for printing help to the commandline.
bool multiplayer_exit_at_end
True if –exit-at-and was given on the command line.
A config object defines a single node in a WML file, with access to child nodes.
std::optional< std::string > campaign_scenario
Non-empty if –campaign-scenario was given on the command line.
std::optional< std::string > validate_schema
Non-empty if –validate-schema was given on the command line.
std::optional< std::pair< int, int > > resolution
Pair of AxB values specified after –resolution.
Thrown when a lexical_cast fails.
std::optional< std::string > plugin_file
File to load a lua plugin (similar to a script) from.
std::optional< std::string > language
Non-empty if –language was given on the command line.