summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-28 00:56:53 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-29 07:38:39 +0100
commit411b54e993ea997e18be18fadd26ceab00c00fa3 (patch)
tree6f95ec02b917e391de95ae8e496e71a314e96b37 /src/net
parent780bcbc2ea75603f2eef7369a6f7b5ddfc5888b5 (diff)
downloadmana-411b54e993ea997e18be18fadd26ceab00c00fa3.tar.gz
mana-411b54e993ea997e18be18fadd26ceab00c00fa3.tar.bz2
mana-411b54e993ea997e18be18fadd26ceab00c00fa3.tar.xz
mana-411b54e993ea997e18be18fadd26ceab00c00fa3.zip
Fixed potential flaw for the number of characters slots on tAthena.
Was happening when logging to the dev manaserv server and then to TMW-eA. The client is still crashing after selecting the characters after relogging but that's not introduced with this patch anyway. Reviewed-by: Crush.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/logindata.h19
-rw-r--r--src/net/tmwa/loginhandler.cpp6
2 files changed, 19 insertions, 6 deletions
diff --git a/src/net/logindata.h b/src/net/logindata.h
index 7f729559..4a1c1a9f 100644
--- a/src/net/logindata.h
+++ b/src/net/logindata.h
@@ -31,12 +31,11 @@ class LoginData
public:
/**
* Constructor
- *
- * Initialize character slots to 3 for TmwAthena compatibility
*/
- LoginData():
- characterSlots(3)
- {}
+ LoginData()
+ {
+ resetCharacterSlots();
+ }
std::string username;
std::string password;
@@ -53,6 +52,14 @@ public:
unsigned short characterSlots; /**< The number of character slots */
+ /**
+ * Initialize character slots to 3 for TmwAthena compatibility
+ */
+ void resetCharacterSlots()
+ {
+ characterSlots = 3; // Default value, used for TmwAthena.
+ }
+
void clear()
{
username.clear();
@@ -62,7 +69,7 @@ public:
email.clear();
captchaResponse.clear();
gender = GENDER_UNSPECIFIED;
- characterSlots = 3; // Default value, used for TmwAthena.
+ resetCharacterSlots();
}
};
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index e58acb4d..00b7b145 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -235,6 +235,12 @@ void LoginHandler::getRegistrationDetails()
void LoginHandler::loginAccount(LoginData *loginData)
{
+ // Since we're attempting to use the tAthena protocol,
+ // let's reset the character slots to the good value,
+ // in case we just logged out a Manaserv server
+ // with a different config.
+ loginData->resetCharacterSlots();
+
sendLoginRegister(loginData->username, loginData->password);
}