diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/gui/char_select.cpp | 7 | ||||
-rw-r--r-- | src/net/charserverhandler.cpp | 30 | ||||
-rw-r--r-- | src/net/charserverhandler.h | 3 |
4 files changed, 38 insertions, 8 deletions
@@ -1,3 +1,9 @@ +2006-08-15 Bjørn Lindeijer <bjorn@lindeijer.nl> + + * src/gui/char_select.cpp, src/net/charserverhandler.h, + src/net/charserverhandler.cpp: Some preparations towards supporting + character select and response handling. + 2006-08-14 Bjørn Lindeijer <bjorn@lindeijer.nl> * src/net/charserverhandler.h, src/net/charserverhandler.cpp: Fix diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 775eea24..775ecc6f 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -215,9 +215,10 @@ void CharSelectDialog::attemptCharDelete() void CharSelectDialog::attemptCharSelect() { // Request character selection - MessageOut outMsg; - outMsg.writeShort(0x0066); - outMsg.writeByte(mCharInfo->getPos()); + MessageOut msg; + msg.writeShort(PAMSG_CHAR_SELECT); + msg.writeByte(mCharInfo->getPos()); + network->send(msg); mCharInfo->lock(); } diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp index b4715315..eb7eb34d 100644 --- a/src/net/charserverhandler.cpp +++ b/src/net/charserverhandler.cpp @@ -57,6 +57,7 @@ CharServerHandler::handleMessage(MessageIn *msg) case APMSG_CHAR_CREATE_RESPONSE: handleCharCreateResponse(*msg); break; + case APMSG_CHAR_DELETE_RESPONSE: { int errMsg = msg->readByte(); @@ -89,6 +90,7 @@ CharServerHandler::handleMessage(MessageIn *msg) } } break; + case APMSG_CHAR_INFO: tempPlayer = readPlayerData(msg, slot); mCharInfo->unlock(); @@ -96,6 +98,10 @@ CharServerHandler::handleMessage(MessageIn *msg) mCharInfo->setEntry(tempPlayer); n_character++; break; + + case PMSG_CHAR_SELECT_RESPONSE: + handleCharSelectResponse(*msg); + break; } } @@ -104,12 +110,8 @@ CharServerHandler::handleCharCreateResponse(MessageIn &msg) { int errMsg = msg.readByte(); - // Character creation successful - if (errMsg == ERRMSG_OK) - { - } // Character creation failed - else + if (errMsg != ERRMSG_OK) { std::string message = ""; switch (errMsg) @@ -155,6 +157,24 @@ CharServerHandler::handleCharCreateResponse(MessageIn &msg) } } +void +CharServerHandler::handleCharSelectResponse(MessageIn &msg) +{ + int errMsg = msg.readByte(); + + if (errMsg == 0) + { + //std::string token = msg.readString(32); + //std::string gameServer = msg.readString(); + //unsigned short gameServerPort = msg.readShort(); + //std::string chatServer = msg.readString(); + //unsigned short chatServerPort = msg.readShort(); + + // TODO: Connect to game and chat servers, and login using the given + // TODO: token. + } +} + LocalPlayer* CharServerHandler::readPlayerData(MessageIn *msg, int &slot) { diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index ec5df3f8..b034b513 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -52,6 +52,9 @@ class CharServerHandler : public MessageHandler void handleCharCreateResponse(MessageIn &msg); + void + handleCharSelectResponse(MessageIn &msg); + LoginData *mLoginData; LockedArray<LocalPlayer*> *mCharInfo; |