Author: zaroth
Date: Thu Jun 9 11:52:27 2011
New Revision: 49802
URL: http://svn.gna.org/viewcvs/wesnoth?rev=49802&view=rev
Log:
Added support for --multiplayer option in commandline_options and its suboptions
Modified:
trunk/src/commandline_options.cpp
trunk/src/commandline_options.hpp
trunk/src/game_controller.cpp
Modified: trunk/src/commandline_options.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/commandline_options.cpp?rev=49802&r1=49801&r2=49802&view=diff
==============================================================================
--- trunk/src/commandline_options.cpp (original)
+++ trunk/src/commandline_options.cpp Thu Jun 9 11:52:27 2011
@@ -41,6 +41,14 @@
load(),
logdomains(),
multiplayer(false),
+ multiplayer_ai_config(),
+ multiplayer_algorithm(),
+ multiplayer_controller(),
+ multiplayer_era(),
+ multiplayer_label(),
+ multiplayer_parm(),
+ multiplayer_side(),
+ multiplayer_turns(),
max_fps(),
nocache(false),
nodelay(false),
@@ -103,15 +111,19 @@
("max-fps", "the maximum fps the game tries to run at. Values
should be between 1 and 1000, the default is 50.")
;
+ po::options_description multiplayer_opts("Multiplayer options");
+ multiplayer_opts.add_options()
+ ("multiplayer,m", "Starts a multiplayer game. There are
additional options that can be used as explained below:")
+ ;
+
hidden_.add_options()
("new_storyscreens", "")
("new-widgets", "")
;
-
- visible_.add(general_opts).add(display_opts);
+ visible_.add(general_opts).add(display_opts).add(multiplayer_opts);
all_.add(visible_).add(hidden_);
-
+
po::variables_map vm;
po::store(po::parse_command_line(argc_,argv_,all_),vm);
Modified: trunk/src/commandline_options.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/commandline_options.hpp?rev=49802&r1=49801&r2=49802&view=diff
==============================================================================
--- trunk/src/commandline_options.hpp (original)
+++ trunk/src/commandline_options.hpp Thu Jun 9 11:52:27 2011
@@ -76,6 +76,22 @@
boost::optional<std::string> logdomains;
/// True if --multiplayer was given on the command line. Goes directly
into multiplayer mode.
bool multiplayer;
+ /// Non-empty if --ai-config was given on the command line. Vector of
pairs (side number, value). Dependant on --multiplayer.
+ boost::optional<std::vector<std::pair<int, std::string> > >
multiplayer_ai_config;
+ /// Non-empty if --algorithm was given on the command line. Vector of
pairs (side number, value). Dependant on --multiplayer.
+ boost::optional<std::vector<std::pair<int, std::string> > >
multiplayer_algorithm;
+ /// Non-empty if --controller was given on the command line. Vector of
pairs (side number, controller). Dependant on --multiplayer.
+ boost::optional<std::vector<std::pair<int, std::string> > >
multiplayer_controller;
+ /// Non-empty if --era was given on the command line. Dependant on
--multiplayer.
+ boost::optional<std::string> multiplayer_era;
+ /// 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.
+ boost::optional<std::vector<std::pair<int, std::pair<std::string,
std::string> > > > multiplayer_parm;
+ /// Non-empty if --side was given on the command line. Vector of pairs
(side number, faction id). Dependant on --multiplayer.
+ boost::optional<std::vector<std::pair<int, std::string> > >
multiplayer_side;
+ /// Non-empty if --turns was given on the command line. Dependant on
--multiplayer.
+ boost::optional<std::string> multiplayer_turns;
/// Max FPS specified by --max-fps option.
boost::optional<int> max_fps;
/// True if --nocache was given on the command line. Disables cache
usage.
Modified: trunk/src/game_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller.cpp?rev=49802&r1=49801&r2=49802&view=diff
==============================================================================
--- trunk/src/game_controller.cpp (original)
+++ trunk/src/game_controller.cpp Thu Jun 9 11:52:27 2011
@@ -119,7 +119,7 @@
if (cmdline_opts_.bpp)
force_bpp_ = *cmdline_opts_.bpp;
- if(cmdline_opts_.debug) {
+ if (cmdline_opts_.debug) {
game_config::debug = true;
game_config::mp_debug = true;
//set the wml log domain to level "debug"
@@ -145,6 +145,8 @@
}
preferences::set_draw_delay(fps);
}
+ if (cmdline_opts_.multiplayer)
+ multiplayer_mode_ = true;
if (cmdline_opts_.new_storyscreens)
// This is a hidden option to help testing
// the work-in-progress new storyscreen code.
@@ -245,9 +247,6 @@
multiplayer_server_ = "";
}
- } else if(val == "--multiplayer" || val == "-m") {
- multiplayer_mode_ = true;
- break; //parse the rest of the arguments when we set up
the game
} else if(val == "--test" || val == "-t") {
test_mode_ = true;
// If we have -t foo it's ambiguous whether it foo is
the parameter
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits