summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-09-02 19:03:28 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-09-02 19:03:28 +0000
commit32e3bd7584cf241027dd8824c936f4c60cff418f (patch)
treea76a0337ec3a962b8c8ce5fe154e42ff0ca2d39e /src/main.cpp
parent3bce14c324e1d7bbd058e18072acc7bd953d6475 (diff)
downloadmana-client-32e3bd7584cf241027dd8824c936f4c60cff418f.tar.gz
mana-client-32e3bd7584cf241027dd8824c936f4c60cff418f.tar.bz2
mana-client-32e3bd7584cf241027dd8824c936f4c60cff418f.tar.xz
mana-client-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.cpp16
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);