diff options
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/adminhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/buysellhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/charserverhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/chathandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/generalhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/gui/guildtab.h | 2 | ||||
-rw-r--r-- | src/net/eathena/gui/partytab.h | 2 | ||||
-rw-r--r-- | src/net/eathena/guildhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/inventoryhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/itemhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/loginhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/messagehandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/messagein.h | 2 | ||||
-rw-r--r-- | src/net/eathena/messageout.h | 2 | ||||
-rw-r--r-- | src/net/eathena/network.cpp | 18 | ||||
-rw-r--r-- | src/net/eathena/network.h | 4 | ||||
-rw-r--r-- | src/net/eathena/npchandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/partyhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/specialhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/tradehandler.h | 2 |
23 files changed, 55 insertions, 9 deletions
diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index ce341e53f..f6a3bc961 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -38,6 +38,8 @@ class AdminHandler final : public MessageHandler, public Ea::AdminHandler public: AdminHandler(); + A_DELETE_COPY(AdminHandler); + void handleMessage(Net::MessageIn &msg); void announce(const std::string &text); diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h index 956b3758a..f278ef72a 100644 --- a/src/net/eathena/beinghandler.h +++ b/src/net/eathena/beinghandler.h @@ -38,6 +38,8 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler public: BeingHandler(bool enableSync); + A_DELETE_COPY(BeingHandler); + virtual void handleMessage(Net::MessageIn &msg); virtual void requestNameById(int id); diff --git a/src/net/eathena/buysellhandler.h b/src/net/eathena/buysellhandler.h index 3985aa184..337e0e8c2 100644 --- a/src/net/eathena/buysellhandler.h +++ b/src/net/eathena/buysellhandler.h @@ -37,6 +37,8 @@ class BuySellHandler final : public MessageHandler, public Ea::BuySellHandler public: BuySellHandler(); + A_DELETE_COPY(BuySellHandler); + virtual void handleMessage(Net::MessageIn &msg); virtual void processNpcBuy(Net::MessageIn &msg); diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index aa24318cf..d5362be28 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -45,6 +45,8 @@ class CharServerHandler final : public MessageHandler, public: CharServerHandler(); + A_DELETE_COPY(CharServerHandler); + virtual void handleMessage(Net::MessageIn &msg); void chooseCharacter(Net::Character *character); diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index ab8f81659..61d926240 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -38,6 +38,8 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler public: ChatHandler(); + A_DELETE_COPY(ChatHandler); + void handleMessage(Net::MessageIn &msg); void talk(const std::string &text); diff --git a/src/net/eathena/gamehandler.h b/src/net/eathena/gamehandler.h index ec0c99c91..05a61a18a 100644 --- a/src/net/eathena/gamehandler.h +++ b/src/net/eathena/gamehandler.h @@ -38,6 +38,8 @@ class GameHandler final : public MessageHandler, public Ea::GameHandler public: GameHandler(); + A_DELETE_COPY(GameHandler); + void handleMessage(Net::MessageIn &msg); void connect(); diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h index 7e3a1ad9e..f20fec9f9 100644 --- a/src/net/eathena/generalhandler.h +++ b/src/net/eathena/generalhandler.h @@ -40,6 +40,8 @@ class GeneralHandler final : public MessageHandler, public: GeneralHandler(); + A_DELETE_COPY(GeneralHandler); + ~GeneralHandler(); void handleMessage(Net::MessageIn &msg); diff --git a/src/net/eathena/gui/guildtab.h b/src/net/eathena/gui/guildtab.h index 55a622c9d..e06e76cf3 100644 --- a/src/net/eathena/gui/guildtab.h +++ b/src/net/eathena/gui/guildtab.h @@ -36,6 +36,8 @@ class GuildTab : public Ea::GuildTab public: GuildTab(); + A_DELETE_COPY(GuildTab); + ~GuildTab(); }; diff --git a/src/net/eathena/gui/partytab.h b/src/net/eathena/gui/partytab.h index 5e9a42e59..ba093fa2d 100644 --- a/src/net/eathena/gui/partytab.h +++ b/src/net/eathena/gui/partytab.h @@ -36,6 +36,8 @@ class PartyTab : public Ea::PartyTab public: PartyTab(); + A_DELETE_COPY(PartyTab); + ~PartyTab(); }; diff --git a/src/net/eathena/guildhandler.h b/src/net/eathena/guildhandler.h index fdcb88368..a1c1c5b0c 100644 --- a/src/net/eathena/guildhandler.h +++ b/src/net/eathena/guildhandler.h @@ -36,6 +36,8 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler public: GuildHandler(); + A_DELETE_COPY(GuildHandler); + ~GuildHandler(); void handleMessage(Net::MessageIn &msg); diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index 5a83e7b87..9291aef89 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -40,6 +40,8 @@ class InventoryHandler final : public MessageHandler, public: InventoryHandler(); + A_DELETE_COPY(InventoryHandler); + ~InventoryHandler(); void handleMessage(Net::MessageIn &msg); diff --git a/src/net/eathena/itemhandler.h b/src/net/eathena/itemhandler.h index 60e65d27a..0c0fea12f 100644 --- a/src/net/eathena/itemhandler.h +++ b/src/net/eathena/itemhandler.h @@ -35,6 +35,8 @@ class ItemHandler final : public MessageHandler, public Ea::ItemHandler public: ItemHandler(); + A_DELETE_COPY(ItemHandler); + virtual void handleMessage(Net::MessageIn &msg); }; diff --git a/src/net/eathena/loginhandler.h b/src/net/eathena/loginhandler.h index 26cafb5c7..de46e890a 100644 --- a/src/net/eathena/loginhandler.h +++ b/src/net/eathena/loginhandler.h @@ -41,6 +41,8 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler public: LoginHandler(); + A_DELETE_COPY(LoginHandler); + ~LoginHandler(); void handleMessage(Net::MessageIn &msg); diff --git a/src/net/eathena/messagehandler.h b/src/net/eathena/messagehandler.h index a8dfa1b5b..4252ed948 100644 --- a/src/net/eathena/messagehandler.h +++ b/src/net/eathena/messagehandler.h @@ -44,6 +44,8 @@ class MessageHandler : public Net::MessageHandler public: MessageHandler(); + A_DELETE_COPY(MessageHandler); + ~MessageHandler(); void setNetwork(Network *network); diff --git a/src/net/eathena/messagein.h b/src/net/eathena/messagein.h index f6a1ec7ba..b2538313c 100644 --- a/src/net/eathena/messagein.h +++ b/src/net/eathena/messagein.h @@ -46,6 +46,8 @@ class MessageIn final : public Net::MessageIn */ MessageIn(const char *data, unsigned int length); + A_DELETE_COPY(MessageIn); + int16_t readInt16(); /**< Reads a short. */ int readInt32(); /**< Reads a long. */ }; diff --git a/src/net/eathena/messageout.h b/src/net/eathena/messageout.h index 530702e7d..79d858c07 100644 --- a/src/net/eathena/messageout.h +++ b/src/net/eathena/messageout.h @@ -48,6 +48,8 @@ class MessageOut final : public Net::MessageOut */ MessageOut(short id); + A_DELETE_COPY(MessageOut); + void writeInt16(int16_t value); /**< Writes a short. */ void writeInt32(int32_t value); /**< Writes a long. */ diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 8a9a010f8..a240a3a74 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -159,24 +159,26 @@ void Network::dispatchMessages() { while (messageReady()) { - MessageIn msg = getNextMessage(); + MessageIn *const msg = getNextMessage(); - const MessageHandlerIterator iter = mMessageHandlers.find(msg.getId()); + const MessageHandlerIterator iter = mMessageHandlers.find( + msg->getId()); - if (msg.getLength() == 0) + if (msg->getLength() == 0) logger->safeError("Zero length packet received. Exiting."); if (iter != mMessageHandlers.end()) { if (iter->second) - iter->second->handleMessage(msg); + iter->second->handleMessage(*msg); } else { - logger->log("Unhandled packet: %x", msg.getId()); + logger->log("Unhandled packet: %x", msg->getId()); } - skip(msg.getLength()); + skip(msg->getLength()); + delete msg; } } @@ -205,7 +207,7 @@ bool Network::messageReady() return ret; } -MessageIn Network::getNextMessage() +MessageIn *Network::getNextMessage() { while (!messageReady()) { @@ -241,7 +243,7 @@ MessageIn Network::getNextMessage() msgId, len)); #endif - MessageIn msg(mInBuffer, len); + MessageIn *msg = new MessageIn(mInBuffer, len); SDL_mutexV(mMutex); return msg; diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index 63ec5a20b..b9cbff28e 100644 --- a/src/net/eathena/network.h +++ b/src/net/eathena/network.h @@ -48,6 +48,8 @@ class Network final : public Ea::Network public: Network(); + A_DELETE_COPY(Network); + ~Network(); void registerHandler(MessageHandler *handler); @@ -58,7 +60,7 @@ class Network final : public Ea::Network bool messageReady(); - MessageIn getNextMessage(); + MessageIn *getNextMessage(); void dispatchMessages(); diff --git a/src/net/eathena/npchandler.h b/src/net/eathena/npchandler.h index 2417629e3..4a98f3aa5 100644 --- a/src/net/eathena/npchandler.h +++ b/src/net/eathena/npchandler.h @@ -42,6 +42,8 @@ class NpcHandler final : public MessageHandler, public Ea::NpcHandler public: NpcHandler(); + A_DELETE_COPY(NpcHandler); + void handleMessage(Net::MessageIn &msg); void talk(int npcId); diff --git a/src/net/eathena/partyhandler.h b/src/net/eathena/partyhandler.h index 22433c668..b9a9f9d56 100644 --- a/src/net/eathena/partyhandler.h +++ b/src/net/eathena/partyhandler.h @@ -37,6 +37,8 @@ class PartyHandler final : public MessageHandler, public Ea::PartyHandler public: PartyHandler(); + A_DELETE_COPY(PartyHandler); + ~PartyHandler(); void handleMessage(Net::MessageIn &msg); diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h index 0dc5d3a17..130a22019 100644 --- a/src/net/eathena/playerhandler.h +++ b/src/net/eathena/playerhandler.h @@ -38,6 +38,8 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler public: PlayerHandler(); + A_DELETE_COPY(PlayerHandler); + void handleMessage(Net::MessageIn &msg); void attack(int id, bool keep = false); diff --git a/src/net/eathena/specialhandler.h b/src/net/eathena/specialhandler.h index e8603ac2e..17989fae2 100644 --- a/src/net/eathena/specialhandler.h +++ b/src/net/eathena/specialhandler.h @@ -38,6 +38,8 @@ class SpecialHandler final : public MessageHandler, public Ea::SpecialHandler public: SpecialHandler(); + A_DELETE_COPY(SpecialHandler); + void handleMessage(Net::MessageIn &msg); void useBeing(int id, int level, int beingId); diff --git a/src/net/eathena/tradehandler.h b/src/net/eathena/tradehandler.h index acd282961..dcff97340 100644 --- a/src/net/eathena/tradehandler.h +++ b/src/net/eathena/tradehandler.h @@ -38,6 +38,8 @@ class TradeHandler final : public MessageHandler, public Ea::TradeHandler public: TradeHandler(); + A_DELETE_COPY(TradeHandler); + void handleMessage(Net::MessageIn &msg); void request(Being *being); |