From a9f6959a96395edc64ff57bf5ba1d75cca8e86c3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Feb 2016 21:19:59 +0300 Subject: Add missing const in net directory. --- src/net/tmwa/adminhandler.cpp | 2 +- src/net/tmwa/adminhandler.h | 3 ++- src/net/tmwa/beinghandler.cpp | 4 ++-- src/net/tmwa/beinghandler.h | 6 +++--- src/net/tmwa/beingrecv.cpp | 2 +- src/net/tmwa/beingrecv.h | 2 +- src/net/tmwa/charserverhandler.cpp | 9 ++++++--- src/net/tmwa/charserverhandler.h | 16 +++++++++------- src/net/tmwa/chathandler.cpp | 8 ++++---- src/net/tmwa/chathandler.h | 11 +++++++---- src/net/tmwa/chatrecv.cpp | 4 ++-- src/net/tmwa/familyhandler.cpp | 4 ++-- src/net/tmwa/familyhandler.h | 5 +++-- src/net/tmwa/gamehandler.cpp | 4 ++-- src/net/tmwa/gamehandler.h | 4 ++-- src/net/tmwa/generalhandler.cpp | 8 ++++---- src/net/tmwa/generalhandler.h | 8 ++++---- src/net/tmwa/guildhandler.cpp | 2 +- src/net/tmwa/guildhandler.h | 2 +- src/net/tmwa/loginhandler.cpp | 4 ++-- src/net/tmwa/loginhandler.h | 4 ++-- src/net/tmwa/markethandler.cpp | 2 +- src/net/tmwa/markethandler.h | 2 +- src/net/tmwa/mercenaryhandler.cpp | 2 +- src/net/tmwa/mercenaryhandler.h | 2 +- src/net/tmwa/network.cpp | 2 +- src/net/tmwa/pethandler.cpp | 3 ++- 27 files changed, 68 insertions(+), 57 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 30c2bfe84..743eeb534 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -122,7 +122,7 @@ void AdminHandler::unequipAll(const Being *const being A_UNUSED) const { } -void AdminHandler::requestStats(const std::string &name A_UNUSED) +void AdminHandler::requestStats(const std::string &name A_UNUSED) const { } diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 78332a402..3a0f6fec5 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -70,7 +70,8 @@ class AdminHandler final : public Ea::AdminHandler void unequipAll(const Being *const being) const override final A_CONST; - void requestStats(const std::string &name) override final A_CONST; + void requestStats(const std::string &name) const override final + A_CONST; }; } // namespace TmwAthena diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 97a189696..52a8bf67c 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -62,11 +62,11 @@ void BeingHandler::undress(Being *const being) const void BeingHandler::requestRanks(const RankT rank A_UNUSED) const { } -#endif -void BeingHandler::viewPlayerEquipment(const Being *const being A_UNUSED) +void BeingHandler::viewPlayerEquipment(const Being *const being A_UNUSED) const { } +#endif void BeingHandler::requestNameByCharId(const int id A_UNUSED) const { diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h index 088620a1b..4f3e70fb1 100644 --- a/src/net/tmwa/beinghandler.h +++ b/src/net/tmwa/beinghandler.h @@ -42,12 +42,12 @@ class BeingHandler final : public Ea::BeingHandler #ifdef EATHENA_SUPPORT void requestRanks(const RankT rank A_UNUSED) const override final A_CONST; + + void viewPlayerEquipment(const Being *const being) const override final + A_CONST; #endif void requestNameByCharId(const int id) const override final A_CONST; - - protected: - void viewPlayerEquipment(const Being *const being) A_CONST; }; } // namespace TmwAthena diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index ea921f91e..0c077b900 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -120,7 +120,7 @@ void BeingRecv::processBeingChangeLook2(Net::MessageIn &msg) BLOCK_END("BeingRecv::processBeingChangeLook") } -void BeingRecv::processBeingChangeLookContinue(Net::MessageIn &msg, +void BeingRecv::processBeingChangeLookContinue(const Net::MessageIn &msg, Being *const dstBeing, const uint8_t type, const int id, diff --git a/src/net/tmwa/beingrecv.h b/src/net/tmwa/beingrecv.h index 53c271b23..afb8e484b 100644 --- a/src/net/tmwa/beingrecv.h +++ b/src/net/tmwa/beingrecv.h @@ -58,7 +58,7 @@ namespace TmwAthena void processBeingStatusChange(Net::MessageIn &msg); void processBeingMove2(Net::MessageIn &msg); void processBeingChangeDirection(Net::MessageIn &msg); - void processBeingChangeLookContinue(Net::MessageIn &msg, + void processBeingChangeLookContinue(const Net::MessageIn &msg, Being *const dstBeing, const uint8_t type, const int id, diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index d7b92be1a..c9db50260 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -56,7 +56,7 @@ CharServerHandler::CharServerHandler() : charServerHandler = this; } -void CharServerHandler::chooseCharacter(Net::Character *const character) +void CharServerHandler::chooseCharacter(Net::Character *const character) const { if (!character) return; @@ -91,6 +91,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot, void CharServerHandler::deleteCharacter(Net::Character *const character, const std::string &email A_UNUSED) + const { if (!character) return; @@ -109,7 +110,7 @@ void CharServerHandler::switchCharacter() const outMsg.writeInt8(1, "flag"); } -void CharServerHandler::connect() +void CharServerHandler::connect() const { const Token &token = static_cast(loginHandler)->getToken(); @@ -141,6 +142,7 @@ void CharServerHandler::connect() } void CharServerHandler::setCharCreateDialog(CharCreateDialog *const window) + const { mCharCreateDialog = window; @@ -179,11 +181,12 @@ void CharServerHandler::setCharCreateDialog(CharCreateDialog *const window) void CharServerHandler::renameCharacter(const BeingId id A_UNUSED, const std::string &newName A_UNUSED) + const { } void CharServerHandler::changeSlot(const int oldSlot A_UNUSED, - const int newSlot A_UNUSED) + const int newSlot A_UNUSED) const { } diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index 3e049e12d..1c202f707 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/charserverhandler.h @@ -38,7 +38,8 @@ class CharServerHandler final : public Ea::CharServerHandler A_DELETE_COPY(CharServerHandler) - void chooseCharacter(Net::Character *const character) override final; + void chooseCharacter(Net::Character *const character) const + override final; void newCharacter(const std::string &name, const int slot, @@ -50,20 +51,21 @@ class CharServerHandler final : public Ea::CharServerHandler const std::vector &stats) const override final; void deleteCharacter(Net::Character *const character, - const std::string &email) override final; + const std::string &email) const override final; void renameCharacter(const BeingId id, - const std::string &newName) override final + const std::string &newName) const override final A_CONST; void switchCharacter() const override final; - void connect() override final; + void connect() const override final; bool isNeedCreatePin() const override final { return false; } - void setNewPincode(const std::string &pin A_UNUSED) override final + void setNewPincode(const std::string &pin A_UNUSED) const + override final { } /** @@ -71,11 +73,11 @@ class CharServerHandler final : public Ea::CharServerHandler * dialog when a new character is successfully created, and will unlock * the dialog when a new character failed to be created. */ - void setCharCreateDialog(CharCreateDialog *const window) + void setCharCreateDialog(CharCreateDialog *const window) const override final; void changeSlot(const int oldSlot, - const int newSlot) override final A_CONST; + const int newSlot) const override final A_CONST; void ping() const override final A_CONST; diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 7d22102fc..998a3eba1 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -71,7 +71,7 @@ void ChatHandler::talkRaw(const std::string &mes) const } void ChatHandler::privateMessage(const std::string &restrict recipient, - const std::string &restrict text) + const std::string &restrict text) const { createOutPacket(CMSG_CHAT_WHISPER); outMsg.writeInt16(CAST_S16(text.length() + 28), "len"); @@ -81,7 +81,7 @@ void ChatHandler::privateMessage(const std::string &restrict recipient, } void ChatHandler::channelMessage(const std::string &restrict channel, - const std::string &restrict text) + const std::string &restrict text) const { if (channel == TRADE_CHANNEL) talk("\302\202" + text, GENERAL_CHANNEL); @@ -200,7 +200,7 @@ void ChatHandler::requestIgnoreList() const void ChatHandler::createChatRoom(const std::string &title A_UNUSED, const std::string &password A_UNUSED, const int limit A_UNUSED, - const bool isPublic A_UNUSED) + const bool isPublic A_UNUSED) const { } @@ -217,7 +217,7 @@ void ChatHandler::joinChannel(const std::string &channel A_UNUSED) { } -void ChatHandler::partChannel(const std::string &channel A_UNUSED) +void ChatHandler::partChannel(const std::string &channel A_UNUSED) const { } diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index 82a53d736..7e5ce94a5 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -42,10 +42,12 @@ class ChatHandler final : public Ea::ChatHandler void talkRaw(const std::string &text) const override final; void privateMessage(const std::string &restrict recipient, - const std::string &restrict text) override final; + const std::string &restrict text) const + override final; void channelMessage(const std::string &restrict channel, - const std::string &restrict text) override final; + const std::string &restrict text) const + override final; void joinChannel(const std::string &channel) override final A_CONST; @@ -60,7 +62,7 @@ class ChatHandler final : public Ea::ChatHandler void createChatRoom(const std::string &title, const std::string &password, const int limit, - const bool isPublic) override final A_CONST; + const bool isPublic) const override final A_CONST; void ignore(const std::string &nick) const override final; @@ -74,7 +76,8 @@ class ChatHandler final : public Ea::ChatHandler const std::string &password) const override final A_CONST; - void partChannel(const std::string &channel) override final A_CONST; + void partChannel(const std::string &channel) const override final + A_CONST; void talkPet(const std::string &restrict text, const std::string &restrict channel) const override final; diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp index f4bb3725d..54c13545a 100644 --- a/src/net/tmwa/chatrecv.cpp +++ b/src/net/tmwa/chatrecv.cpp @@ -122,7 +122,7 @@ void ChatRecv::processChatContinue(std::string chatMsg, void ChatRecv::processGmChat(Net::MessageIn &msg) { BLOCK_START("ChatRecv::processChat") - int chatMsgLength = msg.readInt16("len") - 4; + const int chatMsgLength = msg.readInt16("len") - 4; if (chatMsgLength <= 0) { BLOCK_END("ChatRecv::processChat") @@ -289,7 +289,7 @@ void ChatRecv::processBeingChat(Net::MessageIn &msg) return; BLOCK_START("ChatRecv::processBeingChat") - int chatMsgLength = msg.readInt16("len") - 8; + const int chatMsgLength = msg.readInt16("len") - 8; const BeingId beingId = msg.readBeingId("being id"); Being *const being = actorManager->findBeing(beingId); diff --git a/src/net/tmwa/familyhandler.cpp b/src/net/tmwa/familyhandler.cpp index 2851ac7d7..d0680a8e2 100644 --- a/src/net/tmwa/familyhandler.cpp +++ b/src/net/tmwa/familyhandler.cpp @@ -32,11 +32,11 @@ FamilyHandler::FamilyHandler() familyHandler = this; } -void FamilyHandler::askForChild(const Being *const being A_UNUSED) +void FamilyHandler::askForChild(const Being *const being A_UNUSED) const { } -void FamilyHandler::askForChildReply(const bool accept A_UNUSED) +void FamilyHandler::askForChildReply(const bool accept A_UNUSED) const { } diff --git a/src/net/tmwa/familyhandler.h b/src/net/tmwa/familyhandler.h index 9f43774fb..c01df9e4f 100644 --- a/src/net/tmwa/familyhandler.h +++ b/src/net/tmwa/familyhandler.h @@ -35,9 +35,10 @@ class FamilyHandler final : public Net::FamilyHandler A_DELETE_COPY(FamilyHandler) - void askForChild(const Being *const being) override final A_CONST; + void askForChild(const Being *const being) const override final + A_CONST; - void askForChildReply(const bool accept) override final A_CONST; + void askForChildReply(const bool accept) const override final A_CONST; }; } // namespace TmwAthena diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index fce64e1ec..9c3ff505d 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -55,7 +55,7 @@ void GameHandler::mapLoadedEvent() const createOutPacket(CMSG_MAP_LOADED); } -void GameHandler::connect() +void GameHandler::connect() const { if (!Network::mInstance) return; @@ -105,7 +105,7 @@ bool GameHandler::isConnected() const return Network::mInstance->isConnected(); } -void GameHandler::disconnect() +void GameHandler::disconnect() const { BLOCK_START("GameHandler::disconnect") if (Network::mInstance) diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h index 2e1d298b0..a42935261 100644 --- a/src/net/tmwa/gamehandler.h +++ b/src/net/tmwa/gamehandler.h @@ -35,11 +35,11 @@ class GameHandler final : public Ea::GameHandler A_DELETE_COPY(GameHandler) - void connect() override final; + void connect() const override final; bool isConnected() const override final A_WARN_UNUSED; - void disconnect() override final; + void disconnect() const override final; void quit() const override final; diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 72b533b9f..bc6029a94 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -147,7 +147,7 @@ GeneralHandler::~GeneralHandler() delete2(Network::mInstance); } -void GeneralHandler::load() +void GeneralHandler::load() const { new Network; Network::mInstance->registerHandlers(); @@ -176,7 +176,7 @@ void GeneralHandler::unload() clearHandlers(); } -void GeneralHandler::flushSend() +void GeneralHandler::flushSend() const { if (!Network::mInstance) return; @@ -184,7 +184,7 @@ void GeneralHandler::flushSend() Network::mInstance->flush(); } -void GeneralHandler::flushNetwork() +void GeneralHandler::flushNetwork() const { if (!Network::mInstance) return; @@ -212,7 +212,7 @@ void GeneralHandler::flushNetwork() BLOCK_END("GeneralHandler::flushNetwork 3") } -void GeneralHandler::clearHandlers() +void GeneralHandler::clearHandlers() const { if (Network::mInstance) Network::mInstance->clearHandlers(); diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index c1a9c135a..45efe3345 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -73,17 +73,17 @@ class GeneralHandler final : public Net::GeneralHandler ~GeneralHandler(); - void load() override final; + void load() const override final; void reload() override final; void unload() override final; - void flushNetwork() override final; + void flushNetwork() const override final; - void flushSend() override final; + void flushSend() const override final; - void clearHandlers() override final; + void clearHandlers() const override final; void reloadPartially() const override final; diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 4f0db44c7..2f7d68285 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -140,7 +140,7 @@ void GuildHandler::memberList() const outMsg.writeInt32(1, "action"); // Request member list } -void GuildHandler::info() +void GuildHandler::info() const { // 0 = basic info + alliance info // 1 = position name list + member list diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index aef531777..f26acb95a 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -54,7 +54,7 @@ class GuildHandler final : public Ea::GuildHandler void memberList() const override final; - void info() override final; + void info() const override final; void changeMemberPostion(const GuildMember *const member, const int level) const override final; diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 9634b8153..e5022b2ec 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -51,7 +51,7 @@ LoginHandler::~LoginHandler() { } -void LoginHandler::connect() +void LoginHandler::connect() const { if (!Network::mInstance) return; @@ -72,7 +72,7 @@ bool LoginHandler::isConnected() const Network::mInstance->isConnected(); } -void LoginHandler::disconnect() +void LoginHandler::disconnect() const { if (Network::mInstance && Network::mInstance->getServer() == mServer) Network::mInstance->disconnect(); diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index 20bbc571b..536dfdaaa 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -37,11 +37,11 @@ class LoginHandler final : public Ea::LoginHandler ~LoginHandler(); - void connect() override final; + void connect() const override final; bool isConnected() const override final A_WARN_UNUSED; - void disconnect() override final; + void disconnect() const override final; unsigned int getMaxPasswordLength() const override final A_WARN_UNUSED { return 24; } diff --git a/src/net/tmwa/markethandler.cpp b/src/net/tmwa/markethandler.cpp index f9cb58d41..ecab3790e 100644 --- a/src/net/tmwa/markethandler.cpp +++ b/src/net/tmwa/markethandler.cpp @@ -32,7 +32,7 @@ MarketHandler::MarketHandler() marketHandler = this; } -void MarketHandler::close() +void MarketHandler::close() const { } diff --git a/src/net/tmwa/markethandler.h b/src/net/tmwa/markethandler.h index 4c40abe16..7c99bd164 100644 --- a/src/net/tmwa/markethandler.h +++ b/src/net/tmwa/markethandler.h @@ -34,7 +34,7 @@ class MarketHandler final : public Net::MarketHandler A_DELETE_COPY(MarketHandler) - void close() override final A_CONST; + void close() const override final A_CONST; void buyItem(const int itemId, const int type, diff --git a/src/net/tmwa/mercenaryhandler.cpp b/src/net/tmwa/mercenaryhandler.cpp index c772f1004..ce200daef 100644 --- a/src/net/tmwa/mercenaryhandler.cpp +++ b/src/net/tmwa/mercenaryhandler.cpp @@ -32,7 +32,7 @@ MercenaryHandler::MercenaryHandler() mercenaryHandler = this; } -void MercenaryHandler::fire() +void MercenaryHandler::fire() const { } diff --git a/src/net/tmwa/mercenaryhandler.h b/src/net/tmwa/mercenaryhandler.h index f87bcd01f..760bdf8ac 100644 --- a/src/net/tmwa/mercenaryhandler.h +++ b/src/net/tmwa/mercenaryhandler.h @@ -35,7 +35,7 @@ class MercenaryHandler final : public Net::MercenaryHandler A_DELETE_COPY(MercenaryHandler) - void fire() override final A_CONST; + void fire() const override final A_CONST; void moveToMaster() const override final A_CONST; diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 03a842b65..c326560d9 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -130,7 +130,7 @@ void Network::dispatchMessages() if (msgId < messagesSize) { - PacketFuncPtr func = mPackets[msgId].func; + const PacketFuncPtr func = mPackets[msgId].func; if (func) func(msg); else diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp index 1aaf0e710..7748a4385 100644 --- a/src/net/tmwa/pethandler.cpp +++ b/src/net/tmwa/pethandler.cpp @@ -53,7 +53,8 @@ void PetHandler::spawn(const Being *const being A_UNUSED, { } -void PetHandler::emote(const uint8_t emoteId, const int petId A_UNUSED) +void PetHandler::emote(const uint8_t emoteId, + const int petId A_UNUSED) { mRandCounter ++; if (mRandCounter > 10000) -- cgit v1.2.3-70-g09d2