diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-27 15:17:51 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-27 15:17:51 +0100 |
commit | 3efa949fca06f9a1cad04ff7da8107096ed55044 (patch) | |
tree | a1c7eba105129a028631c5be222140c014a66ae6 /src/main.cpp | |
parent | e480ad5d269ca8dcd200397f7e6157b3e46c5c02 (diff) | |
download | mana-3efa949fca06f9a1cad04ff7da8107096ed55044.tar.gz mana-3efa949fca06f9a1cad04ff7da8107096ed55044.tar.bz2 mana-3efa949fca06f9a1cad04ff7da8107096ed55044.tar.xz mana-3efa949fca06f9a1cad04ff7da8107096ed55044.zip |
Simplified and fixed initialization of login data
Command line parameters were being overridden by old configuration
settings.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/src/main.cpp b/src/main.cpp index 2ce47ac6..8fe1de86 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1099,38 +1099,25 @@ int main(int argc, char *argv[]) sound.playMusic(branding.getValue("loginMusic", "")); - // Server choice - if (options.serverName.empty()) { - loginData.hostname = config.getValue("MostUsedServerName0", - branding.getValue("defaultServer", "server.themanaworld.org").c_str()); - } - else { - loginData.hostname = options.serverName; + // Initialize login data + loginData.hostname = options.serverName; + loginData.port = options.serverPort; + loginData.username = options.username; + loginData.password = options.password; + loginData.remember = config.getValue("remember", 0); + loginData.registerLogin = false; + + if (loginData.hostname.empty()) { + loginData.hostname = branding.getValue("defaultServer", + "server.themanaworld.org").c_str(); } if (options.serverPort == 0) { - loginData.port = (short)config.getValue("MostUsedServerPort0", - branding.getValue("defaultPort", 9601)); - } else { - loginData.port = options.serverPort; + loginData.port = (short) branding.getValue("defaultPort", 9601); } - - loginData.username = options.username; - if (loginData.username.empty()) { - if (config.getValue("remember", 0)) { - loginData.username = config.getValue("username", ""); - } - } - if (!options.password.empty()) { - loginData.password = options.password; + if (loginData.username.empty() && loginData.remember) { + loginData.username = config.getValue("username", ""); } -#ifdef EATHENA_SUPPORT - loginData.hostname = config.getValue("host", "server.themanaworld.org"); - loginData.port = (short)config.getValue("port", 6901); -#endif - loginData.remember = config.getValue("remember", 0); - loginData.registerLogin = false; - #ifdef TMWSERV_SUPPORT Net::initialize(); accountServerConnection = Net::getConnection(); |