summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-11 21:39:51 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-02 17:05:37 +0100
commit78d6d9352f66f41963207b04a999d94c17d67cf2 (patch)
treec286d4a6ebd46bc89808d3e18b2d7d920ea10351 /src/main.cpp
parent8546361abaa6123acd9dc1429575d1fd1cf6a4ec (diff)
downloadmana-78d6d9352f66f41963207b04a999d94c17d67cf2.tar.gz
mana-78d6d9352f66f41963207b04a999d94c17d67cf2.tar.bz2
mana-78d6d9352f66f41963207b04a999d94c17d67cf2.tar.xz
mana-78d6d9352f66f41963207b04a999d94c17d67cf2.zip
Added support for -y / --server-type parameter
Usually this would be guessed correctly by the port, but now it is also possible to just specify the server type and the port will be derived from there, unless a default port is given in the branding file. Closes #56
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b3fd699c..6244b946 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -53,6 +53,7 @@ static void printHelp()
<< _(" -c --character : Login with this character") << endl
<< _(" -s --server : Login server name or IP") << endl
<< _(" -p --port : Login server port") << endl
+ << _(" -y --server-type : Login server type") << endl
<< _(" --update-host : Use this update host") << endl
<< _(" -D --default : Choose default character server and "
"character") << endl
@@ -74,7 +75,7 @@ static void printVersion()
static void parseOptions(int argc, char *argv[], Client::Options &options)
{
- const char *optstring = "hvud:U:P:Dc:s:p:C:";
+ const char *optstring = "hvud:U:P:Dc:s:p:C:y:";
const struct option long_options[] = {
{ "config-dir", required_argument, nullptr, 'C' },
@@ -93,6 +94,7 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
{ "chat-log-dir", required_argument, nullptr, 'T' },
{ "version", no_argument, nullptr, 'v' },
{ "screenshot-dir", required_argument, nullptr, 'i' },
+ { "server-type", required_argument, nullptr, 'y' },
{ nullptr }
};
@@ -132,7 +134,7 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
options.serverName = optarg;
break;
case 'p':
- options.serverPort = (short) atoi(optarg);
+ options.serverPort = static_cast<uint16_t>(atoi(optarg));
break;
case 'u':
options.skipUpdate = true;
@@ -155,6 +157,9 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
case 'i':
options.screenshotDir = optarg;
break;
+ case 'y':
+ options.serverType = optarg;
+ break;
}
}