diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index 469a2c47..9d2a1e64 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -347,7 +347,8 @@ void printHelp() << " -u --skipupdate : Skip the update process" << std::endl << " -U --username : Login with this username" << std::endl << " -P --password : Login with this password" << std::endl - << " -D --default : Bypass the login process with default settings" << std::endl + << " -D --default : Bypass the login process with default settings" + << std::endl << " -s --server : Login Server name or IP" << std::endl << " -o --port : Login Server Port" << std::endl << " -p --playername : Login with this player" << std::endl; @@ -355,7 +356,7 @@ void printHelp() void parseOptions(int argc, char *argv[], Options &options) { - const char *optstring = "huU:P:Dp:so"; + const char *optstring = "huU:P:Dp:s:o:"; const struct option long_options[] = { { "help", no_argument, 0, 'h' }, @@ -666,18 +667,23 @@ int main(int argc, char *argv[]) logger->log("State: CHOOSE_SERVER"); // Allow changing this using a server choice dialog - // We show the dialog box only if the command-line options weren't set. + // We show the dialog box only if the command-line options + // weren't set. if (options.serverName.empty() && options.serverPort == 0) { currentDialog = new ServerDialog(&loginData); } else { logger->log("Trying to connect to account server..."); Network::connect(Network::ACCOUNT, - loginData.hostname, loginData.port); + loginData.hostname, loginData.port); state = STATE_CONNECT_ACCOUNT; + + // Reset options so that cancelling or connect timeout + // will show the server dialog + options.serverName = ""; + options.serverPort = 0; } break; - case STATE_CONNECT_ACCOUNT: logger->log("State: CONNECT_ACCOUNT"); currentDialog = new ConnectionDialog(STATE_CHOOSE_SERVER); |