mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-15 17:25:32 +00:00
Add --ignore-map-settings multiplayer commandline option
This commit is contained in:
parent
2290e3d6b2
commit
eb49509f9a
@ -164,7 +164,7 @@ be preprocessed recursively based on the known preprocessor rules. The common ma
|
||||
from the "data/core/macros" directory will be preprocessed before the specified resources.
|
||||
Example:
|
||||
.B -p ~/wesnoth/data/campaigns/tutorial ~/result.
|
||||
For details regarding the preprocessor visit:
|
||||
For details regarding the preprocessor visit:
|
||||
http://wiki.wesnoth.org/PreprocessorRef#Command-line_preprocessor
|
||||
|
||||
.TP
|
||||
@ -252,6 +252,9 @@ file.
|
||||
exits once the scenario is over, without displaying victory/defeat dialog which requires the user to click OK.
|
||||
This is also used for scriptable benchmarking.
|
||||
.TP
|
||||
.B --ignore-map-settings
|
||||
do not use map settings, use default values instead.
|
||||
.TP
|
||||
.B --nogui
|
||||
runs the game without the GUI. Must appear before
|
||||
.B --multiplayer
|
||||
|
@ -74,6 +74,7 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
||||
multiplayer_controller(),
|
||||
multiplayer_era(),
|
||||
multiplayer_exit_at_end(),
|
||||
multiplayer_ignore_map_settings(),
|
||||
multiplayer_label(),
|
||||
multiplayer_parm(),
|
||||
multiplayer_scenario(),
|
||||
@ -196,6 +197,7 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
||||
("controller", po::value<std::vector<std::string> >()->composing(), "selects the controller for this side. <arg> should have format side:value")
|
||||
("era", po::value<std::string>(), "selects the era to be played in by its id.")
|
||||
("exit-at-end", "exit Wesnoth at the end of the scenario.")
|
||||
("ignore-map-settings", "do not use map settings.")
|
||||
("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.")
|
||||
@ -289,6 +291,8 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
||||
gzip = vm["gzip"].as<std::string>();
|
||||
if (vm.count("help"))
|
||||
help = true;
|
||||
if (vm.count("ignore-map-settings"))
|
||||
multiplayer_ignore_map_settings = true;
|
||||
if (vm.count("label"))
|
||||
multiplayer_label = vm["label"].as<std::string>();
|
||||
if (vm.count("language"))
|
||||
|
@ -94,6 +94,8 @@ public:
|
||||
boost::optional<std::string> multiplayer_era;
|
||||
/// True if --exit-at-and was given on the command line. Dependant on --multiplayer.
|
||||
bool multiplayer_exit_at_end;
|
||||
/// True if --ignore-map-settings was given at the command line. Do not use map settings.
|
||||
bool multiplayer_ignore_map_settings;
|
||||
/// Non-empty if --label was given on the command line. Dependant on --multiplayer.
|
||||
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). Dependant on --multiplayer.
|
||||
|
@ -728,8 +728,13 @@ void start_local_game_commandline(game_display& disp, const config& game_config,
|
||||
parameters.village_support = settings::get_village_support("");
|
||||
parameters.xp_modifier = settings::get_xp_modifier("");
|
||||
|
||||
// By default, we want to use the map setting in commandline mode.
|
||||
parameters.use_map_settings = true;
|
||||
// Do not use map settings if --ignore-map-settings commandline option is set
|
||||
if(cmdline_opts.multiplayer_ignore_map_settings) {
|
||||
DBG_MP << "ignoring map settings" << std::endl;
|
||||
parameters.use_map_settings = false;
|
||||
} else {
|
||||
parameters.use_map_settings = true;
|
||||
}
|
||||
|
||||
// We also want the following in order to be consistent with MP lobby mode:
|
||||
parameters.share_view = true;
|
||||
|
@ -1337,6 +1337,13 @@ void connect::start_game_commandline(const commandline_options& cmdline_opts)
|
||||
}
|
||||
}
|
||||
|
||||
// Having hard-coded values here is undesirable, but that's how it is done in the MP lobby
|
||||
// part of the code also. Should be replaced by settings/constants in both places
|
||||
if(cmdline_opts.multiplayer_ignore_map_settings) {
|
||||
s["gold"] = 100;
|
||||
s["income"] = 1;
|
||||
}
|
||||
|
||||
if (cmdline_opts.multiplayer_parm) {
|
||||
for(std::vector<boost::tuple<unsigned int, std::string, std::string> >::const_iterator
|
||||
parm=cmdline_opts.multiplayer_parm->begin(); parm!=cmdline_opts.multiplayer_parm->end(); ++parm)
|
||||
|
@ -54,6 +54,7 @@ BOOST_AUTO_TEST_CASE (test_empty_options)
|
||||
BOOST_CHECK(!co.multiplayer_controller);
|
||||
BOOST_CHECK(!co.multiplayer_era);
|
||||
BOOST_CHECK(!co.multiplayer_exit_at_end);
|
||||
BOOST_CHECK(!co.multiplayer_ignore_map_settings);
|
||||
BOOST_CHECK(!co.multiplayer_label);
|
||||
BOOST_CHECK(!co.multiplayer_parm);
|
||||
BOOST_CHECK(!co.multiplayer_side);
|
||||
@ -136,6 +137,7 @@ BOOST_AUTO_TEST_CASE (test_default_options)
|
||||
BOOST_CHECK(!co.multiplayer_controller);
|
||||
BOOST_CHECK(!co.multiplayer_era);
|
||||
BOOST_CHECK(!co.multiplayer_exit_at_end);
|
||||
BOOST_CHECK(!co.multiplayer_ignore_map_settings);
|
||||
BOOST_CHECK(!co.multiplayer_label);
|
||||
BOOST_CHECK(!co.multiplayer_parm);
|
||||
BOOST_CHECK(!co.multiplayer_scenario);
|
||||
@ -207,6 +209,7 @@ BOOST_AUTO_TEST_CASE (test_full_options)
|
||||
"--gunzip=gunzipfoo.gz",
|
||||
"--gzip=gzipfoo",
|
||||
"--help",
|
||||
"--ignore-map-settings",
|
||||
"--label=labelfoo",
|
||||
"--load=loadfoo",
|
||||
"--log-error=errfoo,errbar/*",
|
||||
@ -297,6 +300,7 @@ BOOST_AUTO_TEST_CASE (test_full_options)
|
||||
BOOST_CHECK(co.multiplayer_controller->at(1).get<0>() == 6 && co.multiplayer_controller->at(1).get<1>() == "conbar");
|
||||
BOOST_CHECK(co.multiplayer_era && *co.multiplayer_era == "erafoo");
|
||||
BOOST_CHECK(co.multiplayer_exit_at_end);
|
||||
BOOST_CHECK(co.multiplayer_ignore_map_settings);
|
||||
BOOST_CHECK(co.multiplayer_label && *co.multiplayer_label == "labelfoo");
|
||||
BOOST_CHECK(co.multiplayer_parm);
|
||||
BOOST_CHECK(co.multiplayer_parm->at(0).get<0>() == 7 && co.multiplayer_parm->at(0).get<1>() == "parmfoo" && co.multiplayer_parm->at(0).get<2>() == "valfoo");
|
||||
@ -379,6 +383,7 @@ BOOST_AUTO_TEST_CASE (test_positional_options)
|
||||
BOOST_CHECK(!co.multiplayer_controller);
|
||||
BOOST_CHECK(!co.multiplayer_era);
|
||||
BOOST_CHECK(!co.multiplayer_exit_at_end);
|
||||
BOOST_CHECK(!co.multiplayer_ignore_map_settings);
|
||||
BOOST_CHECK(!co.multiplayer_label);
|
||||
BOOST_CHECK(!co.multiplayer_parm);
|
||||
BOOST_CHECK(!co.multiplayer_scenario);
|
||||
|
Loading…
x
Reference in New Issue
Block a user