summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 15:17:51 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 15:17:51 +0100
commit3efa949fca06f9a1cad04ff7da8107096ed55044 (patch)
treea1c7eba105129a028631c5be222140c014a66ae6 /src
parente480ad5d269ca8dcd200397f7e6157b3e46c5c02 (diff)
downloadmana-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')
-rw-r--r--src/gui/login.cpp3
-rw-r--r--src/localplayer.cpp4
-rw-r--r--src/logindata.h2
-rw-r--r--src/main.cpp41
4 files changed, 19 insertions, 31 deletions
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 281a25a2..de328fcc 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -45,7 +45,8 @@ static const int LOGIN_DIALOG_HEIGHT = 140;
static const int FIELD_WIDTH = LOGIN_DIALOG_WIDTH - 70;
LoginDialog::LoginDialog(LoginData *loginData):
- Window(_("Login")), mLoginData(loginData)
+ Window(_("Login")),
+ mLoginData(loginData)
{
gcn::Label *userLabel = new Label(_("Name:"));
gcn::Label *passLabel = new Label(_("Password:"));
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 6046459c..14b32415 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -519,7 +519,6 @@ void LocalPlayer::walk(unsigned char dir)
#ifdef TMWSERV_SUPPORT
const Vector &pos = getPosition();
- int dScaler; // Distance to walk
#endif
if (mAction == WALK && !mPath.empty())
@@ -554,7 +553,6 @@ void LocalPlayer::walk(unsigned char dir)
dx++;
#endif
-
// Prevent skipping corners over colliding tiles
#ifdef TMWSERV_SUPPORT
if (dx && !mMap->getWalk(((int) pos.x + dx) / 32,
@@ -576,6 +574,8 @@ void LocalPlayer::walk(unsigned char dir)
(pos.y + dy) / 32, getWalkMask()))
dx = 16 - (int) pos.x % 32;
+ int dScaler; // Distance to walk
+
// Checks our path up to 5 tiles, if a blocking tile is found
// We go to the last good tile, and break out of the loop
for (dScaler = 1; dScaler <= 10; dScaler++)
diff --git a/src/logindata.h b/src/logindata.h
index ae89eb5f..8ecba235 100644
--- a/src/logindata.h
+++ b/src/logindata.h
@@ -68,7 +68,7 @@ struct LoginData
session_ID2 = 0;
sex = 0;
#endif
- };
+ }
};
#endif // LOGINDATA_H
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();