Added --username and --password options.
Together with the --server option they allow starting several clients that all join the server automatically. When these options are used, preferences are not saved. man page updated, hope I didn't miss anything.
This commit is contained in:
parent
ed8e9f9b59
commit
46b997d11d
4 changed files with 26 additions and 0 deletions
|
@ -189,6 +189,12 @@ sets the screen resolution. Example:
|
|||
connects to the specified host if any, otherwise connect to the first server in preferences. Example:
|
||||
.B --server server.wesnoth.org
|
||||
.TP
|
||||
.BI --username <username>
|
||||
uses <username> when connecting to a server, ignoring other preferences.
|
||||
.TP
|
||||
.BI --password <password>
|
||||
uses <password> when connecting to a server, ignoring other preferences. Unsafe.
|
||||
.TP
|
||||
.B --strict-validation
|
||||
validation errors are treated as fatal errors.
|
||||
.TP
|
||||
|
|
|
@ -100,6 +100,8 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
|||
resolution(),
|
||||
rng_seed(),
|
||||
server(),
|
||||
username(),
|
||||
password(),
|
||||
screenshot(false),
|
||||
screenshot_map_file(),
|
||||
screenshot_output_file(),
|
||||
|
@ -145,6 +147,8 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
|||
("rng-seed", po::value<unsigned int>(), "seeds the random number generator with number <arg>. Example: --rng-seed 0")
|
||||
("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.")
|
||||
("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.")
|
||||
("username", po::value<std::string>(), "uses <username> when connecting to a server, ignoring other preferences.")
|
||||
("password", po::value<std::string>(), "uses <password> when connecting to a server, ignoring other preferences.")
|
||||
("strict-validation", "makes validation errors fatal")
|
||||
("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.")
|
||||
("validcache", "assumes that the cache is valid. (dangerous)")
|
||||
|
@ -351,6 +355,10 @@ commandline_options::commandline_options ( int argc, char** argv ) :
|
|||
}
|
||||
if (vm.count("server"))
|
||||
server = vm["server"].as<std::string>();
|
||||
if (vm.count("username"))
|
||||
username = vm["username"].as<std::string>();
|
||||
if (vm.count("password"))
|
||||
password = vm["password"].as<std::string>();
|
||||
if (vm.count("side"))
|
||||
multiplayer_side = parse_to_uint_string_tuples_(vm["side"].as<std::vector<std::string> >());
|
||||
if (vm.count("test"))
|
||||
|
|
|
@ -146,6 +146,10 @@ public:
|
|||
boost::optional<unsigned int> rng_seed;
|
||||
/// Non-empty if --server was given on the command line. Connects Wesnoth to specified server. If no server was specified afterwards, contains an empty string.
|
||||
boost::optional<std::string> server;
|
||||
/// Non-empty if --username was given on the command line. Forces Wesnoth to use this network username.
|
||||
boost::optional<std::string> username;
|
||||
/// Non-empty if --password was given on the command line. Forces Wesnoth to use this network password.
|
||||
boost::optional<std::string> password;
|
||||
/// True if --screenshot was given on the command line. Starts Wesnoth in screenshot mode.
|
||||
bool screenshot;
|
||||
/// Map file to make a screenshot of. First parameter given after --screenshot.
|
||||
|
|
|
@ -237,6 +237,14 @@ game_controller::game_controller(const commandline_options& cmdline_opts, const
|
|||
multiplayer_server_ = "";
|
||||
}
|
||||
}
|
||||
if (cmdline_opts_.username) {
|
||||
preferences::disable_preferences_save();
|
||||
preferences::set_login(*cmdline_opts_.username);
|
||||
}
|
||||
if (cmdline_opts_.password) {
|
||||
preferences::disable_preferences_save();
|
||||
preferences::set_password(*cmdline_opts_.password);
|
||||
}
|
||||
if (cmdline_opts_.smallgui)
|
||||
game_config::small_gui = true;
|
||||
if (cmdline_opts_.test)
|
||||
|
|
Loading…
Add table
Reference in a new issue