diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-09-02 19:03:28 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-09-02 19:03:28 +0000 |
commit | 32e3bd7584cf241027dd8824c936f4c60cff418f (patch) | |
tree | a76a0337ec3a962b8c8ce5fe154e42ff0ca2d39e /src/main.cpp | |
parent | 3bce14c324e1d7bbd058e18072acc7bd953d6475 (diff) | |
download | mana-32e3bd7584cf241027dd8824c936f4c60cff418f.tar.gz mana-32e3bd7584cf241027dd8824c936f4c60cff418f.tar.bz2 mana-32e3bd7584cf241027dd8824c936f4c60cff418f.tar.xz mana-32e3bd7584cf241027dd8824c936f4c60cff418f.zip |
Fixed crash when using short versions of server and port command line options
and made sure cancelling the account server connect shows the server dialog.
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); |