diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-10 01:40:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-10 01:40:58 +0300 |
commit | dd996d01676d7dca3eec442b14c4966ba0bb0935 (patch) | |
tree | cf33c3b0ab342ad7eace2c79d75fa5ba3e852f5e /src/net/tmwa | |
parent | 75d9cadaf376cad8f7244ee4d4632e94c0ef3bc0 (diff) | |
download | mv-dd996d01676d7dca3eec442b14c4966ba0bb0935.tar.gz mv-dd996d01676d7dca3eec442b14c4966ba0bb0935.tar.bz2 mv-dd996d01676d7dca3eec442b14c4966ba0bb0935.tar.xz mv-dd996d01676d7dca3eec442b14c4966ba0bb0935.zip |
Delete copy constructor from net classes.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/adminhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/buysellhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/gui/guildtab.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/gui/partytab.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/itemhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/messagehandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/messagein.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/messageout.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 18 | ||||
-rw-r--r-- | src/net/tmwa/network.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/partyhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/questhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/specialhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.h | 2 |
24 files changed, 57 insertions, 9 deletions
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 6bb1b9fd0..34d009f05 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/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/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h index a5732166c..94ba5b234 100644 --- a/src/net/tmwa/beinghandler.h +++ b/src/net/tmwa/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/tmwa/buysellhandler.h b/src/net/tmwa/buysellhandler.h index 4c9736cf2..942a00c11 100644 --- a/src/net/tmwa/buysellhandler.h +++ b/src/net/tmwa/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/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index f85d128b6..61cf6333d 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/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/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index 4d46bbeac..95af1068d 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/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/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h index 9dac38d19..117555bda 100644 --- a/src/net/tmwa/gamehandler.h +++ b/src/net/tmwa/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/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index 1438ce4db..0358b6020 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -39,6 +39,8 @@ class GeneralHandler final : public MessageHandler, public Net::GeneralHandler, public: GeneralHandler(); + A_DELETE_COPY(GeneralHandler); + ~GeneralHandler(); void handleMessage(Net::MessageIn &msg); diff --git a/src/net/tmwa/gui/guildtab.h b/src/net/tmwa/gui/guildtab.h index 351dadfd6..5fe71f236 100644 --- a/src/net/tmwa/gui/guildtab.h +++ b/src/net/tmwa/gui/guildtab.h @@ -36,6 +36,8 @@ class GuildTab : public Ea::GuildTab public: GuildTab(); + A_DELETE_COPY(GuildTab); + ~GuildTab(); }; diff --git a/src/net/tmwa/gui/partytab.h b/src/net/tmwa/gui/partytab.h index 0bdc11372..e1a5e94b1 100644 --- a/src/net/tmwa/gui/partytab.h +++ b/src/net/tmwa/gui/partytab.h @@ -36,6 +36,8 @@ class PartyTab : public Ea::PartyTab public: PartyTab(); + A_DELETE_COPY(PartyTab); + ~PartyTab(); }; diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index bea2b2c3b..8a4bae92b 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/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/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index 7e3fabf42..a84e43f5f 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/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/tmwa/itemhandler.h b/src/net/tmwa/itemhandler.h index 02fbba796..a66169015 100644 --- a/src/net/tmwa/itemhandler.h +++ b/src/net/tmwa/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/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index 108b5fbd3..b2149caff 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/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/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h index 930fe4858..b5012d906 100644 --- a/src/net/tmwa/messagehandler.h +++ b/src/net/tmwa/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/tmwa/messagein.h b/src/net/tmwa/messagein.h index adc79a6b8..8c5fc7c77 100644 --- a/src/net/tmwa/messagein.h +++ b/src/net/tmwa/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/tmwa/messageout.h b/src/net/tmwa/messageout.h index 72341c4c1..6ebcca8e3 100644 --- a/src/net/tmwa/messageout.h +++ b/src/net/tmwa/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/tmwa/network.cpp b/src/net/tmwa/network.cpp index 15200fa50..278f8e2fd 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -137,24 +137,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; } } @@ -193,7 +195,7 @@ bool Network::messageReady() return ret; } -MessageIn Network::getNextMessage() +MessageIn *Network::getNextMessage() { while (!messageReady()) { @@ -219,7 +221,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/tmwa/network.h b/src/net/tmwa/network.h index 4db67e92c..2ec62d25c 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -49,6 +49,8 @@ class Network final : public Ea::Network public: Network(); + A_DELETE_COPY(Network); + ~Network(); void registerHandler(MessageHandler *handler); @@ -59,7 +61,7 @@ class Network final : public Ea::Network bool messageReady(); - MessageIn getNextMessage(); + MessageIn *getNextMessage(); void dispatchMessages(); diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index a10c455f3..3b0f29d64 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/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/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h index 61b873d5d..3b92b7c33 100644 --- a/src/net/tmwa/partyhandler.h +++ b/src/net/tmwa/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/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index 6633eb506..923e3e934 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/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/tmwa/questhandler.h b/src/net/tmwa/questhandler.h index a2f7ad9a7..09e6ef362 100644 --- a/src/net/tmwa/questhandler.h +++ b/src/net/tmwa/questhandler.h @@ -38,6 +38,8 @@ class QuestHandler final : public MessageHandler public: QuestHandler(); + A_DELETE_COPY(QuestHandler); + void handleMessage(Net::MessageIn &msg); void processSetQuestVar(Net::MessageIn &msg); diff --git a/src/net/tmwa/specialhandler.h b/src/net/tmwa/specialhandler.h index 3fbca307c..9213f270f 100644 --- a/src/net/tmwa/specialhandler.h +++ b/src/net/tmwa/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/tmwa/tradehandler.h b/src/net/tmwa/tradehandler.h index 8ac152e71..c16172a83 100644 --- a/src/net/tmwa/tradehandler.h +++ b/src/net/tmwa/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); |