summaryrefslogtreecommitdiff
path: root/src/net/ea/charserverhandler.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2009-10-06 23:40:55 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2009-10-06 23:43:40 +0200
commit64a37da4cb8d74a29f369e96e8c3669275516394 (patch)
treecaa0eb0d05ab5674b6b6ac822d151aa2585721e8 /src/net/ea/charserverhandler.cpp
parent610dc30ceecdfe538f71826689630e0f28c278cc (diff)
downloadmana-client-64a37da4cb8d74a29f369e96e8c3669275516394.tar.gz
mana-client-64a37da4cb8d74a29f369e96e8c3669275516394.tar.bz2
mana-client-64a37da4cb8d74a29f369e96e8c3669275516394.tar.xz
mana-client-64a37da4cb8d74a29f369e96e8c3669275516394.zip
Some cleanup regarding keeping track of gender for eAthena
LoginHandler now owns the world list and the token, instead of having them as global variables with pointers to the 'sex' member of the token from the GUI.
Diffstat (limited to 'src/net/ea/charserverhandler.cpp')
-rw-r--r--src/net/ea/charserverhandler.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index e538eeaf..13c3cf45 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -21,13 +21,14 @@
#include "net/ea/charserverhandler.h"
-#include "net/ea/generalhandler.h"
+#include "net/ea/loginhandler.h"
#include "net/ea/network.h"
#include "net/ea/protocol.h"
#include "net/logindata.h"
#include "net/messagein.h"
#include "net/messageout.h"
+#include "net/net.h"
#include "game.h"
#include "log.h"
@@ -44,7 +45,7 @@
Net::CharHandler *charHandler;
namespace EAthena {
-extern Token netToken;
+
extern ServerInfo charServer;
extern ServerInfo mapServer;
@@ -177,8 +178,11 @@ void CharServerHandler::handleMessage(MessageIn &msg)
LocalPlayer *CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
{
+ const Token &token =
+ static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
+
LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0, NULL);
- tempPlayer->setGender(netToken.sex);
+ tempPlayer->setGender(token.sex);
tempPlayer->setExp(msg.readInt32());
tempPlayer->setMoney(msg.readInt32());
@@ -241,8 +245,11 @@ void CharServerHandler::setCharCreateDialog(CharCreateDialog *window)
attributes.push_back(_("Dexterity:"));
attributes.push_back(_("Luck:"));
+ const Token &token =
+ static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
+
mCharCreateDialog->setAttributes(attributes, 30, 1, 9);
- mCharCreateDialog->setFixedGender(true, netToken.sex);
+ mCharCreateDialog->setFixedGender(true, token.sex);
}
void CharServerHandler::getCharacters()
@@ -279,16 +286,19 @@ void CharServerHandler::deleteCharacter(int slot, LocalPlayer* character)
void CharServerHandler::connect()
{
+ const Token &token =
+ static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
+
mNetwork->disconnect();
mNetwork->connect(charServer);
MessageOut outMsg(CMSG_CHAR_SERVER_CONNECT);
- outMsg.writeInt32(netToken.account_ID);
- outMsg.writeInt32(netToken.session_ID1);
- outMsg.writeInt32(netToken.session_ID2);
+ outMsg.writeInt32(token.account_ID);
+ outMsg.writeInt32(token.session_ID1);
+ outMsg.writeInt32(token.session_ID2);
// [Fate] The next word is unused by the old char server, so we squeeze in
// tmw client version information
outMsg.writeInt16(CLIENT_PROTOCOL_VERSION);
- outMsg.writeInt8((netToken.sex == GENDER_MALE) ? 1 : 0);
+ outMsg.writeInt8((token.sex == GENDER_MALE) ? 1 : 0);
// We get 4 useless bytes before the real answer comes in (what are these?)
mNetwork->skip(4);