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 | |
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.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 40 | ||||
-rw-r--r-- | src/main.cpp | 16 |
3 files changed, 37 insertions, 25 deletions
@@ -1,3 +1,9 @@ +2006-09-02 Bjørn Lindeijer <bjorn@lindeijer.nl> + + * src/gui/serverdialog.cpp, src/main.cpp: 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. + 2006-09-02 Guillaume Melquiond <guillaume.melquiond@gmail.com> * src/localplayer.cpp, src/beingmanager.h, src/beingmanager.cpp, diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 36b4a7a0..944b0ae0 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -22,25 +22,25 @@ */ #include "serverdialog.h" -
+ #include <iostream> -#include <string>
-
-// TODO : Replace the dropdown by our own skinned one.
-#include <guichan/widgets/dropdown.hpp>
-#include <guichan/widgets/label.hpp>
- -#include "button.h"
-#include "listbox.h"
-#include "ok_dialog.h"
-#include "scrollarea.h"
-#include "textfield.h"
-
-#include "../configuration.h"
-#include "../log.h"
+#include <string> + +// TODO : Replace the dropdown by our own skinned one. +#include <guichan/widgets/dropdown.hpp> +#include <guichan/widgets/label.hpp> + +#include "button.h" +#include "listbox.h" +#include "ok_dialog.h" +#include "scrollarea.h" +#include "textfield.h" + +#include "../configuration.h" +#include "../log.h" #include "../logindata.h" -#include "../main.h"
-
+#include "../main.h" + #include "../utils/tostring.h" const short MAX_SERVERLIST = 5; @@ -238,9 +238,9 @@ ServerDialog::action(const std::string &eventId, gcn::Widget *widget) config.setValue(currentConfig, toString(currentServer.port)); } logger->log("Trying to connect to account server..."); - Network::connect(Network::ACCOUNT, - mLoginData->hostname, mLoginData->port); - state = STATE_CONNECT_ACCOUNT; + Network::connect(Network::ACCOUNT, + mLoginData->hostname, mLoginData->port); + state = STATE_CONNECT_ACCOUNT; } } else if (eventId == "cancel") 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); |