diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-16 18:02:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-16 18:02:08 +0300 |
commit | cef3523b7692bd08fa90e98cd6f87184a15960c9 (patch) | |
tree | c1cd5b0027bd099bcfe1b9d40b7cf191c8fb5879 | |
parent | 8df6afa68f9192321f98942348cbcb757ef7bbdc (diff) | |
download | manaverse-cef3523b7692bd08fa90e98cd6f87184a15960c9.tar.gz manaverse-cef3523b7692bd08fa90e98cd6f87184a15960c9.tar.bz2 manaverse-cef3523b7692bd08fa90e98cd6f87184a15960c9.tar.xz manaverse-cef3523b7692bd08fa90e98cd6f87184a15960c9.zip |
Add new command option --server-type.
It can accept values: eathena, evol, evol2, tmwathena
-rw-r--r-- | docs/manaplus.6 | 3 | ||||
-rw-r--r-- | src/client.cpp | 5 | ||||
-rw-r--r-- | src/main.cpp | 8 | ||||
-rw-r--r-- | src/options.h | 2 |
4 files changed, 17 insertions, 1 deletions
diff --git a/docs/manaplus.6 b/docs/manaplus.6 index 507092aab..051d054e8 100644 --- a/docs/manaplus.6 +++ b/docs/manaplus.6 @@ -42,6 +42,9 @@ Login with this character. .B \-s, \-\-server Login server name or IP. .TP +.B \-y, \-\-server-type +Login server type. +.TP .B \-p, \-\-port Login server port. .TP diff --git a/src/client.cpp b/src/client.cpp index 8a6f885c7..f0919ed9a 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -404,6 +404,11 @@ void Client::gameInit() // Initialize default server mCurrentServer.hostname = settings.options.serverName; mCurrentServer.port = settings.options.serverPort; + if (!settings.options.serverType.empty()) + { + mCurrentServer.type = ServerInfo::parseType( + settings.options.serverType); + } loginData.username = settings.options.username; loginData.password = settings.options.password; diff --git a/src/main.cpp b/src/main.cpp index 7fc00918f..da445aab6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -107,6 +107,8 @@ static void printHelp() // TRANSLATORS: command line help << _(" -s --server : Login server name or IP") << std::endl // TRANSLATORS: command line help + << _(" -y --server-type : Login server type") << std::endl + // TRANSLATORS: command line help << _(" -p --port : Login server port") << std::endl // TRANSLATORS: command line help << _(" -H --update-host : Use this update host") << std::endl @@ -146,7 +148,7 @@ static void printVersion() static void parseOptions(const int argc, char *const argv[]) { - const char *const optstring = "hvud:U:P:Dc:p:l:L:C:s:t:T:a:r"; + const char *const optstring = "hvud:U:P:Dc:p:y:l:L:C:s:t:T:a:r"; const struct option long_options[] = { @@ -171,6 +173,7 @@ static void parseOptions(const int argc, char *const argv[]) { "tests", no_argument, nullptr, 'T' }, { "test", required_argument, nullptr, 't' }, { "renderer", required_argument, nullptr, 'r' }, + { "server-type", required_argument, nullptr, 'y' }, { nullptr, 0, nullptr, 0 } }; @@ -256,6 +259,9 @@ static void parseOptions(const int argc, char *const argv[]) case 'r': options.renderer = static_cast<int>(atoi(optarg)); break; + case 'y': + options.serverType = optarg; + break; default: break; } diff --git a/src/options.h b/src/options.h index def02200b..7f4a63ca7 100644 --- a/src/options.h +++ b/src/options.h @@ -54,6 +54,7 @@ struct Options final screenshotDir(), test(), serverName(), + serverType(), renderer(-1), serverPort(0), printHelp(false), @@ -79,6 +80,7 @@ struct Options final std::string screenshotDir; std::string test; std::string serverName; + std::string serverType; int renderer; uint16_t serverPort; bool printHelp; |