diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-13 18:06:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-13 18:06:59 +0300 |
commit | 71e2ff27012ea70955388cfb7c6c760028711eac (patch) | |
tree | 3549850970318563e1fd369ba825edadb9a0ac53 | |
parent | 5d92f01a20948ad20868e50a28830186c9cd1546 (diff) | |
download | mv-71e2ff27012ea70955388cfb7c6c760028711eac.tar.gz mv-71e2ff27012ea70955388cfb7c6c760028711eac.tar.bz2 mv-71e2ff27012ea70955388cfb7c6c760028711eac.tar.xz mv-71e2ff27012ea70955388cfb7c6c760028711eac.zip |
Split processCharCreate for each packet type.
-rw-r--r-- | src/net/eathena/charserverhandler.cpp | 3 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 25 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.h | 2 |
3 files changed, 26 insertions, 4 deletions
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 |