mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 20:01:15 +00:00
Add command line parameter "--repeat <arg>"
This will repeat a --multiplayer game <arg> times. This is useful for batch testing with --nogui.
This commit is contained in:
parent
2303ae9911
commit
961c97f622
@ -118,6 +118,9 @@ Version 1.11.6+dev:
|
||||
set_preferences_dir() when built with MSVC++ 2010 and a relative path
|
||||
to My Documents was passed with --config-dir in the command line.
|
||||
* Changed: Added -Wno-deprecated-register to strict compilation.
|
||||
* Added command line option "--repeat <arg>". A game started with
|
||||
--multiplayer will be repeated <arg> times. This is useful for
|
||||
batch testing.
|
||||
|
||||
Version 1.11.6:
|
||||
* Add-ons client:
|
||||
|
@ -76,6 +76,7 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
||||
multiplayer_ignore_map_settings(),
|
||||
multiplayer_label(),
|
||||
multiplayer_parm(),
|
||||
multiplayer_repeat(),
|
||||
multiplayer_scenario(),
|
||||
multiplayer_side(),
|
||||
multiplayer_turns(),
|
||||
@ -196,6 +197,7 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
||||
("label", po::value<std::string>(), "sets the label for AIs.") //TODO is the description precise? this option was undocumented before.
|
||||
("nogui", "runs the game without the GUI.")
|
||||
("parm", po::value<std::vector<std::string> >()->composing(), "sets additional parameters for this side. <arg> should have format side:name:value.")
|
||||
("repeat", po::value<unsigned int>(), "repeats a multiplayer game after it is finished <arg> times.")
|
||||
("scenario", po::value<std::string>(), "selects a multiplayer scenario. The default scenario is \"multiplayer_The_Freelands\".")
|
||||
("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.")
|
||||
("turns", po::value<std::string>(), "sets the number of turns. The default is \"50\".")
|
||||
@ -346,6 +348,8 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
||||
proxy_port = vm["proxy-port"].as<std::string>();
|
||||
if (vm.count("proxy-user"))
|
||||
proxy_user = vm["proxy-user"].as<std::string>();
|
||||
if (vm.count("repeat"))
|
||||
multiplayer_repeat = vm["repeat"].as<unsigned int>();
|
||||
if (vm.count("resolution"))
|
||||
parse_resolution_(vm["resolution"].as<std::string>());
|
||||
if (vm.count("rng-seed"))
|
||||
|
@ -99,6 +99,8 @@ public:
|
||||
boost::optional<std::string> multiplayer_label;
|
||||
/// Non-empty if --parm was given on the command line. Vector of pairs (side number, parm name, parm value). Dependent on --multiplayer.
|
||||
boost::optional<std::vector<boost::tuple<unsigned int, std::string, std::string> > > multiplayer_parm;
|
||||
/// Repeats specified by --repeat option. Repeats a multiplayer game after it is finished. Dependent on --multiplayer.
|
||||
boost::optional<unsigned int> multiplayer_repeat;
|
||||
/// Non-empty if --scenario was given on the command line. Dependent on --multiplayer.
|
||||
boost::optional<std::string> multiplayer_scenario;
|
||||
/// Non-empty if --side was given on the command line. Vector of pairs (side number, faction id). Dependent on --multiplayer.
|
||||
|
@ -870,7 +870,11 @@ void start_local_game_commandline(game_display& disp, const config& game_config,
|
||||
if (cmdline_opts.multiplayer_label) label = *cmdline_opts.multiplayer_label;
|
||||
recorder.add_log_data("ai_log","ai_label",label);
|
||||
|
||||
play_game(disp, state, game_config, IO_SERVER, false, false);
|
||||
unsigned int repeat = (cmdline_opts.multiplayer_repeat) ? *cmdline_opts.multiplayer_repeat : 1;
|
||||
for(unsigned int i = 0; i < repeat; i++){
|
||||
game_state state_copy(state);
|
||||
play_game(disp, state_copy, game_config, IO_SERVER, false, false);
|
||||
}
|
||||
recorder.clear();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user