diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/loginhandler.cpp | 18 | ||||
-rw-r--r-- | src/net/loginhandler.h | 8 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp index d65f7001..5b8fbd1f 100644 --- a/src/net/loginhandler.cpp +++ b/src/net/loginhandler.cpp @@ -27,12 +27,10 @@ #include "network.h" #include "protocol.h" +#include "../localplayer.h" #include "../log.h" #include "../logindata.h" #include "../main.h" -#include "../serverinfo.h" - -extern SERVER_INFO **server_info; LoginHandler::LoginHandler() { @@ -56,9 +54,19 @@ void LoginHandler::handleMessage(MessageIn *msg) charNumber = msg->readByte(); printf("Account has %i characters:\n", charNumber); for (unsigned int i = 0; i < charNumber; i++) { - printf("%i) %s\n", i, msg->readString().c_str()); + // Create a temp empty player to show up in character + // selection dialog + LocalPlayer *temp = new LocalPlayer(0, 0, 0); + temp->setName(msg->readString()); + temp->setSex(msg->readByte()); + temp->setHairStyle(msg->readByte()); + temp->setHairColor(msg->readByte()); + temp->mLevel = msg->readByte(); + temp->mGp = msg->readShort(); + mCharInfo->select(i); + mCharInfo->setEntry(temp); } - state = CHAR_SERVER_STATE; + state = CHAR_SELECT_STATE; } // Login failed else diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index 52014559..7d5d6f75 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -26,7 +26,10 @@ #include "messagehandler.h" -struct LoginData; +#include "../lockedarray.h" + +class LocalPlayer; +class LoginData; class LoginHandler : public MessageHandler { @@ -35,10 +38,13 @@ class LoginHandler : public MessageHandler void handleMessage(MessageIn *msg); + void setCharInfo(LockedArray<LocalPlayer*> *charInfo) { mCharInfo = charInfo; }; + void setLoginData(LoginData *loginData) { mLoginData = loginData; }; protected: LoginData *mLoginData; + LockedArray<LocalPlayer*> *mCharInfo; }; #endif |