24 #include <boost/any.hpp>
25 #include <boost/program_options/cmdline.hpp>
26 #include <boost/program_options/errors.hpp>
27 #include <boost/program_options/parsers.hpp>
28 #include <boost/program_options/positional_options.hpp>
29 #include <boost/program_options/value_semantic.hpp>
30 #include <boost/program_options/variables_map.hpp>
31 #include <boost/version.hpp>
34 namespace po = boost::program_options;
37 class two_strings :
public boost::tuple<std::string,std::string> {};
43 if (values.size() != 2)
44 #
if BOOST_VERSION >= 104200
45 throw po::validation_error(po::validation_error::invalid_option_value);
47 throw po::validation_error(
"Invalid number of strings provided to option requiring exactly two of them.");
49 ret_val.get<0>() = values.at(0);
50 ret_val.get<1>() = values.at(1);
56 <<
"\" (WIDTHxHEIGHT expected)").str())
63 <<
"\" (" << expected_format <<
" expected)").str())
71 campaign_difficulty(),
78 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
92 log_precise_timestamps(false),
94 multiplayer_ai_config(),
95 multiplayer_algorithm(),
96 multiplayer_controller(),
98 multiplayer_exit_at_end(),
99 multiplayer_ignore_map_settings(),
102 multiplayer_repeat(),
103 multiplayer_scenario(),
116 preprocess_defines(),
117 preprocess_input_macros(),
118 preprocess_output_macros(),
127 screenshot_map_file(),
128 screenshot_output_file(),
129 script_unsafe_mode(false),
130 strict_validation(false),
133 headless_unit_test(false),
134 noreplaycheck(false),
136 userconfig_path(false),
138 userdata_path(false),
144 args_(args.begin() + 1 , args.
end()),
145 args0_(*args.begin()),
152 po::options_description general_opts(
"General options");
153 general_opts.add_options()
154 (
"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.")
155 (
"bzip2", po::value<std::string>(),
"compresses a file (<arg>) in bzip2 format, stores it as <arg>.bz2 and removes <arg>.")
156 (
"clock",
"Adds the option to show a clock for testing the drawing timer.")
157 (
"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-path and userconfig-path instead.")
158 (
"config-path",
"prints the path of the userdata directory and exits. DEPRECATED: use userdata-path and userconfig-path instead.")
159 (
"core", po::value<std::string>(),
"overrides the loaded core with the one whose id is specified.")
160 (
"data-dir", po::value<std::string>(),
"overrides the data directory with the one specified.")
161 (
"data-path",
"prints the path of the data directory and exits.")
162 (
"debug,d",
"enables additional command mode options in-game.")
163 (
"debug-lua",
"enables some Lua debugging mechanisms")
164 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
165 (
"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).")
166 (
"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.")
168 (
"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>.")
169 (
"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.")
170 (
"gzip", po::value<std::string>(),
"compresses a file (<arg>) in gzip format, stores it as <arg>.gz and removes <arg>.")
171 (
"help,h",
"prints this message and exits.")
172 (
"language,L", po::value<std::string>(),
"uses language <arg> (symbol) this session. Example: --language ang_GB@latin")
173 (
"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.")
174 (
"noaddons",
"disables the loading of all add-ons.")
175 (
"nocache",
"disables caching of game data.")
176 (
"nodelay",
"runs the game without any delays.")
177 (
"nomusic",
"runs the game without music.")
178 (
"nosound",
"runs the game without sounds and music.")
179 (
"path",
"prints the path to the data directory and exits.")
180 (
"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.")
181 (
"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 outputs to a windows .bmp file."
183 " Implies --wconsole."
186 (
"rng-seed", po::value<unsigned int>(),
"seeds the random number generator with number <arg>. Example: --rng-seed 0")
187 (
"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."
189 " Implies --wconsole."
192 (
"script", po::value<std::string>(),
"(experimental) file containing a lua script to control the client")
193 (
"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 lua the same permissions as the wesnoth executable.")
194 (
"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.")
195 (
"username", po::value<std::string>(),
"uses <username> when connecting to a server, ignoring other preferences.")
196 (
"password", po::value<std::string>(),
"uses <password> when connecting to a server, ignoring other preferences.")
197 (
"strict-validation",
"makes validation errors fatal")
198 (
"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.")
199 (
"userconfig-path",
"prints the path of the user config directory and exits.")
200 (
"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.")
201 (
"userdata-path",
"prints the path of the userdata directory and exits.")
202 (
"validcache",
"assumes that the cache is valid. (dangerous)")
203 (
"version,v",
"prints the game's version number and exits.")
204 (
"with-replay",
"replays the file loaded with the --load option.")
206 (
"wconsole",
"attaches a console window on startup (Windows only). Implied by any option that prints something and exits.")
210 po::options_description campaign_opts(
"Campaign options");
211 campaign_opts.add_options()
212 (
"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.")
213 (
"campaign-difficulty", po::value<int>(),
"The difficulty of the specified campaign (1 to max). If none specified, the campaign difficulty selection widget will appear.")
214 (
"campaign-scenario", po::value<std::string>(),
"The id of the scenario from the specified campaign. The default is the first scenario.")
217 po::options_description display_opts(
"Display options");
218 display_opts.add_options()
219 (
"fps",
"displays the number of frames per second the game is currently running at, in a corner of the screen.")
220 (
"fullscreen,f",
"runs the game in full screen mode.")
221 (
"max-fps", po::value<int>(),
"the maximum fps the game tries to run at. Values should be between 1 and 1000, the default is 50.")
222 (
"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.")
223 (
"resolution,r", po::value<std::string>(),
"sets the screen resolution. <arg> should have format XxY. Example: --resolution 800x600")
224 (
"windowed,w",
"runs the game in windowed mode.")
227 po::options_description logging_opts(
"Logging options");
228 logging_opts.add_options()
229 (
"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.")
230 (
"log-error", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'error'. <arg> should be given as comma separated list of domains, wildcards are allowed. Example: --log-error=network,gui/*,engine/enemies")
231 (
"log-warning", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'warning'. Similar to --log-error.")
232 (
"log-info", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'info'. Similar to --log-error.")
233 (
"log-debug", po::value<std::string>(),
"sets the severity level of the specified log domain(s) to 'debug'. Similar to --log-error.")
234 (
"log-precise",
"shows the timestamps in the logfile with more precision.")
237 po::options_description multiplayer_opts(
"Multiplayer options");
238 multiplayer_opts.add_options()
239 (
"multiplayer,m",
"Starts a multiplayer game. There are additional options that can be used as explained below:")
240 (
"ai-config",
po::value<std::vector<std::string> >()->composing(),
"selects a configuration file to load for this side. <arg> should have format side:value")
241 (
"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")
242 (
"controller",
po::value<std::vector<std::string> >()->composing(),
"selects the controller for this side. <arg> should have format side:value")
243 (
"era", po::value<std::string>(),
"selects the era to be played in by its id.")
244 (
"exit-at-end",
"exit Wesnoth at the end of the scenario.")
245 (
"ignore-map-settings",
"do not use map settings.")
246 (
"label", po::value<std::string>(),
"sets the label for AIs.")
247 (
"multiplayer-repeat", po::value<unsigned int>(),
"repeats a multiplayer game after it is finished <arg> times.")
248 (
"nogui",
"runs the game without the GUI.")
249 (
"parm", po::value<std::vector<std::string> >()->composing(),
"sets additional parameters for this side. <arg> should have format side:name:value.")
250 (
"scenario", po::value<std::string>(),
"selects a multiplayer scenario. The default scenario is \"multiplayer_The_Freelands\".")
251 (
"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.")
252 (
"turns", po::value<std::string>(),
"sets the number of turns. The default is \"50\".")
255 po::options_description testing_opts(
"Testing options");
256 testing_opts.add_options()
257 (
"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.")
258 (
"unit,u", po::value<std::string>()->implicit_value(
std::string()),
"runs a unit test scenario. Works like test, except that the exit code of the program reflects the victory / defeat conditions of the scenario.\n\t0 - PASS\n\t1 - FAIL\n\t2 - FAIL (TIMEOUT)\n\t3 - FAIL (INVALID REPLAY)\n\t4 - FAIL (ERRORED REPLAY)")
259 (
"showgui",
"don't run headlessly (for debugging a failing test)")
260 (
"timeout", po::value<unsigned int>(),
"sets a timeout (milliseconds) for the unit test. (DEPRECATED)")
261 (
"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.")
262 (
"noreplaycheck",
"don't try to validate replay of unit test.")
263 (
"mp-test",
"load the test mp scenarios.")
266 po::options_description preprocessor_opts(
"Preprocessor mode options");
267 preprocessor_opts.add_options()
268 (
"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.")
269 (
"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")
270 (
"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.")
271 (
"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.")
274 po::options_description proxy_opts(
"Proxy options");
275 proxy_opts.add_options()
276 (
"proxy",
"enables usage of proxy for network connections.")
277 (
"proxy-address", po::value<std::string>(),
"specifies address of the proxy.")
278 (
"proxy-port", po::value<std::string>(),
"specifies port of the proxy.")
279 (
"proxy-user", po::value<std::string>(),
"specifies username to log in to the proxy.")
280 (
"proxy-password", po::value<std::string>(),
"specifies password to log in to the proxy.")
286 visible_.add(general_opts).add(campaign_opts).add(display_opts).add(logging_opts).add(multiplayer_opts).add(testing_opts).add(preprocessor_opts).add(proxy_opts);
290 po::positional_options_description positional;
291 positional.add(
"data-dir",1);
293 po::variables_map vm;
294 const int parsing_style = po::command_line_style::default_style ^ po::command_line_style::allow_guessing;
297 if (vm.count(
"ai-config"))
299 if (vm.count(
"algorithm"))
301 if (vm.count(
"bunzip2"))
302 bunzip2 = vm[
"bunzip2"].as<std::string>();
303 if (vm.count(
"bzip2"))
304 bzip2 = vm[
"bzip2"].as<std::string>();
305 if (vm.count(
"campaign"))
306 campaign = vm[
"campaign"].as<std::string>();
307 if (vm.count(
"campaign-difficulty"))
309 if (vm.count(
"campaign-scenario"))
311 if (vm.count(
"clock"))
313 if (vm.count(
"core"))
314 core_id = vm[
"core"].as<std::string>();
315 if (vm.count(
"config-dir"))
317 if (vm.count(
"config-path"))
319 if (vm.count(
"controller"))
321 if (vm.count(
"data-dir"))
322 data_dir = vm[
"data-dir"].as<std::string>();
323 if (vm.count(
"data-path"))
325 if (vm.count(
"debug"))
327 if (vm.count(
"debug-lua"))
329 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
330 if (vm.count(
"debug-dot-domain")) {
331 debug_dot_domain = vm[
"debug-dot-domain"].as<
std::string>();
333 if (vm.count(
"debug-dot-level")) {
334 debug_dot_level = vm[
"debug-dot-level"].as<
std::string>();
337 if (vm.count(
"editor"))
338 editor = vm[
"editor"].as<std::string>();
341 if (vm.count(
"exit-at-end"))
345 if (vm.count(
"fullscreen"))
347 if (vm.count(
"gunzip"))
348 gunzip = vm[
"gunzip"].as<std::string>();
349 if (vm.count(
"gzip"))
350 gzip = vm[
"gzip"].as<std::string>();
351 if (vm.count(
"help"))
353 if (vm.count(
"ignore-map-settings"))
355 if (vm.count(
"label"))
357 if (vm.count(
"language"))
358 language = vm[
"language"].as<std::string>();
359 if (vm.count(
"load"))
360 load = vm[
"load"].as<std::string>();
361 if (vm.count(
"log-error"))
363 if (vm.count(
"log-warning"))
365 if (vm.count(
"log-info"))
367 if (vm.count(
"log-debug"))
369 if (vm.count(
"logdomains"))
370 logdomains = vm[
"logdomains"].as<std::string>();
371 if (vm.count(
"log-precise"))
373 if (vm.count(
"log-strict"))
375 if (vm.count(
"max-fps"))
376 max_fps = vm[
"max-fps"].as<int>();
377 if (vm.count(
"mp-test"))
379 if (vm.count(
"multiplayer"))
381 if (vm.count(
"multiplayer-repeat"))
383 if (vm.count(
"new-widgets"))
385 if (vm.count(
"noaddons"))
387 if (vm.count(
"nocache"))
389 if (vm.count(
"nodelay"))
391 if (vm.count(
"nomusic"))
393 if (vm.count(
"noreplaycheck"))
395 if (vm.count(
"nosound"))
397 if (vm.count(
"nogui"))
399 if (vm.count(
"parm"))
401 if (vm.count(
"path"))
403 if (vm.count(
"preprocess"))
409 if (vm.count(
"preprocess-defines"))
411 if (vm.count(
"preprocess-input-macros"))
413 if (vm.count(
"preprocess-output-macros"))
415 if (vm.count(
"resolution"))
417 if (vm.count(
"rng-seed"))
418 rng_seed = vm[
"rng-seed"].as<unsigned int>();
419 if (vm.count(
"scenario"))
421 if (vm.count(
"render-image"))
426 if (vm.count(
"screenshot"))
432 if (vm.count(
"script"))
434 if (vm.count(
"unsafe-scripts"))
436 if (vm.count(
"plugin"))
438 if (vm.count(
"server"))
439 server = vm[
"server"].as<std::string>();
440 if (vm.count(
"username"))
441 username = vm[
"username"].as<std::string>();
442 if (vm.count(
"password"))
443 password = vm[
"password"].as<std::string>();
444 if (vm.count(
"side"))
446 if (vm.count(
"test"))
447 test = vm[
"test"].as<std::string>();
448 if (vm.count(
"unit"))
453 if (vm.count(
"showgui"))
455 if (vm.count(
"timeout"))
456 timeout = vm[
"timeout"].as<unsigned int>();
457 if (vm.count(
"noreplaycheck"))
459 if (vm.count(
"turns"))
461 if (vm.count(
"strict-validation"))
463 if (vm.count(
"userconfig-dir"))
465 if (vm.count(
"userconfig-path"))
467 if (vm.count(
"userdata-dir"))
469 if (vm.count(
"userdata-path"))
471 if (vm.count(
"validcache"))
473 if (vm.count(
"version"))
475 if (vm.count(
"windowed"))
477 if (vm.count(
"with-replay"))
487 log = std::vector<boost::tuple<int, std::string> >();
488 log->push_back(boost::tuple<int, std::string>(severity,domain));
495 if (severity ==
l->get_name()) {
500 std::cerr <<
"Unrecognized argument to --log-strict : " << severity <<
" . \nDisabling strict mode logging." << std::endl;
506 const std::vector<std::string> tokens =
utils::split(resolution_string,
'x');
507 if (tokens.size() != 2) {
520 resolution = boost::tuple<int,int>(xres,yres);
525 std::vector<boost::tuple<unsigned int,std::string> > vec;
526 boost::tuple<unsigned int,std::string> elem;
532 const std::vector<std::string> tokens =
utils::split(
s, separator);
533 if(tokens.size() != 2) {
544 elem.get<0>() = temp;
545 elem.get<1>() = tokens[1];
553 std::vector<boost::tuple<unsigned int,std::string,std::string> > vec;
554 boost::tuple<unsigned int,std::string,std::string> elem;
556 =
std::string() +
"UINT" + separator +
"STRING" + separator +
"STRING";
560 const std::vector<std::string> tokens =
utils::split(
s, separator);
561 if(tokens.size() != 3) {
571 elem.get<0>() = temp;
572 elem.get<1>() = tokens[1];
573 elem.get<2>() = tokens[2];
581 os <<
"Usage: " << cmdline_opts.
args0_ <<
" [<options>] [<data-directory>]\n";
boost::optional< std::string > core_id
Non-empty if –core was given on the command line. Chooses the core to be loaded. ...
bool log_precise_timestamps
True if –log-precise was given on the command line. Shows timestamps in log with more precision...
boost::optional< std::string > script_file
File to load lua script from.
bool new_widgets
Do we wish to use the new library or not.
std::vector< std::string > args_
bool mptest
True if –mp-test was given on the command line.
static domain_map * domains
boost::program_options::options_description all_
boost::optional< std::vector< boost::tuple< unsigned int, std::string, std::string > > > multiplayer_parm
Non-empty if –parm was given on the command line. Vector of pairs (side number, parm name...
bool nogui
True if –nogui was given on the command line. Disables GUI.
boost::optional< std::string > multiplayer_turns
Non-empty if –turns was given on the command line. Dependent on –multiplayer.
bool script_unsafe_mode
Whether to load the "package" package for the scripting environment. (This allows to load arbitrary l...
boost::optional< std::vector< boost::tuple< unsigned int, std::string > > > multiplayer_algorithm
Non-empty if –algorithm was given on the command line. Vector of pairs (side number, value). Dependent on –multiplayer.
boost::optional< std::string > bzip2
Non-empty if –bzip2 was given on the command line. Compresses a file to .bz2 and exits...
commandline_options(const std::vector< std::string > &args)
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. Disables the loading of all add-ons.
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. Prints path to user data directory and exits...
boost::optional< std::string > multiplayer_scenario
Non-empty if –scenario was given on the command line. Dependent on –multiplayer.
bool multiplayer_ignore_map_settings
True if –ignore-map-settings was given at the command line. Do not use map settings.
boost::optional< std::string > username
Non-empty if –username was given on the command line. Forces Wesnoth to use this network username...
boost::optional< std::string > gunzip
Non-empty if –gunzip was given on the command line. Uncompresses a .gz file and exits.
boost::optional< std::string > campaign_scenario
Non-empty if –campaign-scenario was given on the command line. Chooses starting scenario in the camp...
boost::optional< int > max_fps
Max FPS specified by –max-fps option.
boost::optional< unsigned int > rng_seed
RNG seed specified by –rng-seed option. Initializes RNG with given seed.
bool fps
True if –fps was given on the command line. Shows number of fps.
boost::optional< std::string > data_dir
Non-empty if –data-dir was given on the command line. Sets the config dir to the specified one...
boost::optional< std::vector< boost::tuple< int, std::string > > > log
Contains parsed arguments of –log-* (e.g.
bool noreplaycheck
True if –noreplaycheck was given on the comand line. Dependent on –unit.
std::vector< boost::tuple< 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...
boost::optional< std::string > multiplayer_era
Non-empty if –era was given on the command line. Dependent on –multiplayer.
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)
boost::optional< std::string > plugin_file
File to load a lua plugin (similar to a script) from. Experimental / may replace script.
boost::optional< std::string > multiplayer_label
Non-empty if –label was given on the command line. Dependent on –multiplayer.
boost::optional< std::string > load
Non-empty if –load was given on the command line. Savegame specified to load after start...
GLboolean GLenum GLenum GLvoid * values
bool preprocess
True if –preprocess was given on the command line. Starts Wesnoth in preprocessor-only mode...
bool with_replay
True if –with-replay was given on the command line. Shows replay of the loaded file.
bool headless_unit_test
True if –unit is used and –showgui is not present.
GLsizei const char ** path
boost::optional< std::string > userconfig_dir
Non-empty if –userconfig-dir was given on the command line. Sets the user config dir to the specifie...
boost::optional< std::vector< boost::tuple< unsigned int, std::string > > > multiplayer_controller
Non-empty if –controller was given on the command line. Vector of pairs (side number, controller). Dependent on –multiplayer.
std::ostream & operator<<(std::ostream &os, const commandline_options &cmdline_opts)
bool nodelay
True if –nodelay was given on the command line.
GLsizei const GLfloat * value
boost::optional< std::string > logdomains
Non-empty if –logdomains was given on the command line. Prints possible logdomains filtered by given...
bool windowed
True if –windowed was given on the command line. Starts Wesnoth in windowed mode.
boost::optional< std::string > userdata_dir
Non-empty if –userdata-dir was given on the command line. Sets the user data dir to the specified on...
boost::optional< std::string > gzip
Non-empty if –gzip was given on the command line. Compresses a file to .gz and exits.
std::pair< int, int > resolution()
boost::optional< std::string > preprocess_output_macros
Non-empty if –preprocess-output-macros was given on the command line. Outputs all preprocessed macro...
boost::optional< std::string > test
Non-empty if –test was given on the command line. Goes directly into test mode, into a scenario...
bool multiplayer
True if –multiplayer was given on the command line. Goes directly into multiplayer mode...
Manage the empty-palette in the editor.
bool clock
True if –clock was given on the command line. Enables.
Templates and utility-routines for strings and numbers.
bool userconfig_path
True if –userconfig-path was given on the command line. Prints path to user config directory and exi...
boost::optional< std::string > render_image
Image path to render. First parameter after –render-image.
boost::optional< int > campaign_difficulty
Non-empty if –campaign-difficulty was given on the command line. Numerical difficulty of the campaig...
bool nomusic
True if –nomusic was given on the command line. Disables music.
GLsizei const GLchar ** strings
boost::optional< std::string > password
Non-empty if –password was given on the command line. Forces Wesnoth to use this network password...
boost::optional< std::string > preprocess_target
Target (output) path that was given to the –preprocess option.
bool debug
True if –debug was given on the command line. Enables debug mode.
bool debug_lua
True if –debug-lua was given in the commandline. Enables some Lua debugging mechanisms.
bool nocache
True if –nocache was given on the command line. Disables cache usage.
static bool fullscreen(CVideo &video)
boost::optional< std::string > screenshot_map_file
Map file to make a screenshot of. First parameter given after –screenshot.
GLbitfield GLuint64 timeout
boost::optional< std::string > preprocess_path
Path to parse that was given to the –preprocess option.
void set_strict_severity(int severity)
bool new_widgets
True if –new-widgets was given on the command line. Hidden option to enable the new widget toolkit...
boost::optional< std::string > bunzip2
Non-empty if –bunzip2 was given on the command line. Uncompresses a .bz2 file and exits...
boost::optional< std::vector< boost::tuple< unsigned int, std::string > > > multiplayer_ai_config
Non-empty if –ai-config was given on the command line. Vector of pairs (side number, value). Dependent on –multiplayer.
boost::optional< std::vector< boost::tuple< unsigned int, std::string > > > multiplayer_side
Non-empty if –side was given on the command line. Vector of pairs (side number, faction id)...
bad_commandline_resolution(const std::string &resolution)
std::vector< boost::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...
static void validate(boost::any &v, const std::vector< std::string > &values, two_strings *, int)
boost::optional< std::string > render_image_dst
Output file to put rendered image path in. Optional second parameter after –render-image.
void parse_log_strictness(const std::string &severity)
bool data_path
True if –data-path was given on the command line. Prints path to data directory and exits...
bool screenshot
True if –screenshot was given on the command line. Starts Wesnoth in screenshot mode.
boost::optional< std::string > unit_test
Non-empty if –unit was given on the command line. Goes directly into unit test mode, into a scenario, if specified.
boost::optional< unsigned int > multiplayer_repeat
Repeats specified by –multiplayer-repeat option. Repeats a multiplayer game after it is finished...
bool version
True if –version was given on the command line. Prints version and exits.
Standard logging facilities (interface).
boost::optional< std::string > screenshot_output_file
Output file to put screenshot in. Second parameter given after –screenshot.
bool fullscreen
True if –fullscreen was given on the command line. Starts Wesnoth in fullscreen mode.
bool validcache
True if –validcache was given on the command line. Makes Wesnoth assume the cache is valid...
bool strict_validation
True if –strict-validation was given on the command line. Makes Wesnoth trust validation errors as f...
boost::optional< std::vector< std::string > > preprocess_defines
Defines that were given to the –preprocess option.
boost::optional< std::string > language
Non-empty if –language was given on the command line. Sets the language for this session...
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
bool nosound
True if –nosound was given on the command line. Disables sound.
boost::optional< std::string > preprocess_input_macros
Non-empty if –preprocess-input-macros was given on the command line. Specifies a file that contains ...
boost::program_options::options_description visible_
bool multiplayer_exit_at_end
True if –exit-at-and was given on the command line. Dependent on –multiplayer.
boost::optional< std::string > campaign
Non-empty if –campaign was given on the command line. ID of the campaign we want to start...
A config object defines a single node in a WML file, with access to child nodes.
Thrown when a lexical_cast fails.
const std::string version
GLsizei const GLcharARB ** string
boost::optional< std::string > server
Non-empty if –server was given on the command line. Connects Wesnoth to specified server...
boost::optional< boost::tuple< int, int > > resolution
Pair of AxB values specified after –resolution. Changes Wesnoth resolution.