From 008bf570587fb34382cca58e8d3fd909c9a621f8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Oct 2013 16:44:28 +0300 Subject: move virtual member calls from messagein constuctor into postInit. --- src/net/eathena/messagein.cpp | 4 ++++ src/net/eathena/messagein.h | 2 ++ src/net/eathena/network.cpp | 1 + src/net/tmwa/messagein.cpp | 4 ++++ src/net/tmwa/messagein.h | 2 ++ src/net/tmwa/network.cpp | 1 + 6 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/net/eathena/messagein.cpp b/src/net/eathena/messagein.cpp index 221a782bb..bd24d8d04 100644 --- a/src/net/eathena/messagein.cpp +++ b/src/net/eathena/messagein.cpp @@ -37,6 +37,10 @@ namespace EAthena MessageIn::MessageIn(const char *const data, const unsigned int length) : Net::MessageIn(data, length) +{ +} + +void MessageIn::postInit() { // Read the message ID mId = readInt16(); diff --git a/src/net/eathena/messagein.h b/src/net/eathena/messagein.h index a73e4c93b..377ab7b33 100644 --- a/src/net/eathena/messagein.h +++ b/src/net/eathena/messagein.h @@ -45,6 +45,8 @@ class MessageIn final : public Net::MessageIn A_DELETE_COPY(MessageIn) + void postInit(); + int16_t readInt16(); /**< Reads a short. */ int32_t readInt32(); /**< Reads a long. */ }; diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 481a945ba..9fde34fd0 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -183,6 +183,7 @@ void Network::dispatchMessages() len = readWord(2); MessageIn msg(mInBuffer, len); + msg.postInit(); SDL_mutexV(mMutexIn); if (len == 0) diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index dac641414..4d8b334f3 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -37,6 +37,10 @@ namespace TmwAthena MessageIn::MessageIn(const char *const data, const unsigned int length) : Net::MessageIn(data, length) +{ +} + +void MessageIn::postInit() { // Read the message ID mId = readInt16(); diff --git a/src/net/tmwa/messagein.h b/src/net/tmwa/messagein.h index a17260177..50afff011 100644 --- a/src/net/tmwa/messagein.h +++ b/src/net/tmwa/messagein.h @@ -45,6 +45,8 @@ class MessageIn final : public Net::MessageIn A_DELETE_COPY(MessageIn) + void postInit(); + int16_t readInt16(); /**< Reads a short. */ int32_t readInt32(); /**< Reads a long. */ }; diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 515b66c89..8fe89ac52 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -156,6 +156,7 @@ void Network::dispatchMessages() len = readWord(2); MessageIn msg(mInBuffer, len); + msg.postInit(); SDL_mutexV(mMutexIn); BLOCK_END("Network::dispatchMessages 2") BLOCK_START("Network::dispatchMessages 3") -- cgit v1.2.3-70-g09d2