From 71e2ff27012ea70955388cfb7c6c760028711eac Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Sep 2014 18:06:59 +0300 Subject: Split processCharCreate for each packet type. --- src/net/eathena/charserverhandler.cpp | 3 +-- src/net/tmwa/charserverhandler.cpp | 25 +++++++++++++++++++++++-- src/net/tmwa/charserverhandler.h | 2 ++ 3 files changed, 26 insertions(+), 4 deletions(-) (limited to 'src/net') diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 771a9128b..d7d7be582 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -101,7 +101,6 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_CHAR_CREATE_SUCCEEDED: - case SMSG_CHAR_CREATE_SUCCEEDED2: processCharCreate(msg); break; @@ -443,7 +442,7 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg) { BLOCK_START("CharServerHandler::processCharCreate") Net::Character *const character = new Net::Character; - readPlayerData(msg, character, msg.getId() == SMSG_CHAR_CREATE_SUCCEEDED2); + readPlayerData(msg, character, false); mCharacters.push_back(character); updateCharSelectDialog(); diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 4167a3620..3fed3b568 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -94,10 +94,13 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_CHAR_CREATE_SUCCEEDED: - case SMSG_CHAR_CREATE_SUCCEEDED2: processCharCreate(msg); break; + case SMSG_CHAR_CREATE_SUCCEEDED2: + processCharCreate2(msg); + break; + case SMSG_CHAR_CREATE_FAILED: processCharCreateFailed(msg); break; @@ -435,7 +438,7 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg) { BLOCK_START("CharServerHandler::processCharCreate") Net::Character *const character = new Net::Character; - readPlayerData(msg, character, msg.getId() == SMSG_CHAR_CREATE_SUCCEEDED2); + readPlayerData(msg, character, false); mCharacters.push_back(character); updateCharSelectDialog(); @@ -449,4 +452,22 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg) BLOCK_END("CharServerHandler::processCharCreate") } +void CharServerHandler::processCharCreate2(Net::MessageIn &msg) +{ + BLOCK_START("CharServerHandler::processCharCreate2") + Net::Character *const character = new Net::Character; + readPlayerData(msg, character, true); + mCharacters.push_back(character); + + updateCharSelectDialog(); + + // Close the character create dialog + if (mCharCreateDialog) + { + mCharCreateDialog->scheduleDelete(); + mCharCreateDialog = nullptr; + } + BLOCK_END("CharServerHandler::processCharCreate2") +} + } // namespace TmwAthena diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index 02e732bc8..b8cb5182e 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/charserverhandler.h @@ -75,6 +75,8 @@ class CharServerHandler final : public MessageHandler, const bool withColors) const override final; void processCharCreate(Net::MessageIn &msg); + + void processCharCreate2(Net::MessageIn &msg); }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2