diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-20 21:19:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-20 21:19:59 +0300 |
commit | a9f6959a96395edc64ff57bf5ba1d75cca8e86c3 (patch) | |
tree | f6975bea7e87380ee7d063ccfb2efbc835341c91 /src/net | |
parent | 3e8fecc9a62afff0054fa0fa23af86c8ef15a1c9 (diff) | |
download | manaplus-a9f6959a96395edc64ff57bf5ba1d75cca8e86c3.tar.gz manaplus-a9f6959a96395edc64ff57bf5ba1d75cca8e86c3.tar.bz2 manaplus-a9f6959a96395edc64ff57bf5ba1d75cca8e86c3.tar.xz manaplus-a9f6959a96395edc64ff57bf5ba1d75cca8e86c3.zip |
Add missing const in net directory.
Diffstat (limited to 'src/net')
86 files changed, 228 insertions, 198 deletions
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 82f91b431..71796c01d 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -95,7 +95,7 @@ class AdminHandler notfinal virtual void unequipAll(const Being *const being) const = 0; - virtual void requestStats(const std::string &name) = 0; + virtual void requestStats(const std::string &name) const = 0; }; } // namespace Net diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index 2af6254ce..ac8495a5b 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -43,6 +43,8 @@ class BeingHandler notfinal #ifdef EATHENA_SUPPORT virtual void requestRanks(const RankT rank) const = 0; + + virtual void viewPlayerEquipment(const Being *const being) const = 0; #endif }; diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index e43b5bfae..c053eff81 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -43,13 +43,16 @@ class CharServerHandler notfinal virtual ~CharServerHandler() { } - virtual void setCharSelectDialog(CharSelectDialog *const window) = 0; + virtual void setCharSelectDialog(CharSelectDialog *const window) + const = 0; - virtual void setCharCreateDialog(CharCreateDialog *const window) = 0; + virtual void setCharCreateDialog(CharCreateDialog *const window) + const = 0; virtual void requestCharacters() = 0; - virtual void chooseCharacter(Net::Character *const character) = 0; + virtual void chooseCharacter(Net::Character *const character) + const = 0; virtual void newCharacter(const std::string &name, const int slot, @@ -61,10 +64,10 @@ class CharServerHandler notfinal const std::vector<int> &stats) const = 0; virtual void deleteCharacter(Net::Character *const character, - const std::string &email) = 0; + const std::string &email) const = 0; virtual void renameCharacter(const BeingId id, - const std::string &newName) = 0; + const std::string &newName) const = 0; virtual void switchCharacter() const = 0; @@ -76,13 +79,14 @@ class CharServerHandler notfinal virtual unsigned int maxSprite() const A_WARN_UNUSED = 0; - virtual void clear() = 0; + virtual void clear() const = 0; virtual bool isNeedCreatePin() const = 0; - virtual void setNewPincode(const std::string &pin) = 0; + virtual void setNewPincode(const std::string &pin) const = 0; - virtual void changeSlot(const int oldSlot, const int newSlot) = 0; + virtual void changeSlot(const int oldSlot, + const int newSlot) const = 0; virtual void ping() const = 0; diff --git a/src/net/chathandler.h b/src/net/chathandler.h index bbbaaf638..c619b353a 100644 --- a/src/net/chathandler.h +++ b/src/net/chathandler.h @@ -50,14 +50,16 @@ class ChatHandler notfinal const std::string &restrict channel) const = 0; virtual void privateMessage(const std::string &restrict recipient, - const std::string &restrict text) = 0; + const std::string &restrict text) + const = 0; virtual void channelMessage(const std::string &restrict channel, - const std::string &restrict text) = 0; + const std::string &restrict text) + const = 0; virtual void joinChannel(const std::string &channel) = 0; - virtual void partChannel(const std::string &channel) = 0; + virtual void partChannel(const std::string &channel) const = 0; virtual void who() const = 0; @@ -73,12 +75,12 @@ class ChatHandler notfinal virtual void requestIgnoreList() const = 0; - virtual void clear() = 0; + virtual void clear() const = 0; virtual void createChatRoom(const std::string &title, const std::string &password, const int limit, - const bool isPublic) = 0; + const bool isPublic) const = 0; virtual void leaveChatRoom() const = 0; diff --git a/src/net/download.h b/src/net/download.h index 706e73be2..9ffd76cea 100644 --- a/src/net/download.h +++ b/src/net/download.h @@ -30,9 +30,9 @@ #include "localconsts.h" typedef int (*DownloadUpdate)(void *ptr, - DownloadStatusT status, + const DownloadStatusT status, size_t total, - size_t remaining); + const size_t remaining); // Matches what CURL expects typedef size_t (*WriteFunction)( void *ptr, size_t size, size_t nmemb, diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 75d83f490..28ed96bab 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -44,6 +44,7 @@ CharServerHandler::CharServerHandler() : } void CharServerHandler::setCharSelectDialog(CharSelectDialog *const window) + const { mCharSelectDialog = window; updateCharSelectDialog(); @@ -69,7 +70,7 @@ unsigned int CharServerHandler::maxSprite() const return EA_SPRITE_VECTOREND; } -void CharServerHandler::clear() +void CharServerHandler::clear() const { delete_all(mCharacters); mCharacters.clear(); diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h index e1972af05..c16328a82 100644 --- a/src/net/ea/charserverhandler.h +++ b/src/net/ea/charserverhandler.h @@ -36,7 +36,7 @@ class CharServerHandler notfinal : public Net::CharServerHandler public: A_DELETE_COPY(CharServerHandler) - void setCharSelectDialog(CharSelectDialog *const window) + void setCharSelectDialog(CharSelectDialog *const window) const override final; void requestCharacters() override final; @@ -47,9 +47,9 @@ class CharServerHandler notfinal : public Net::CharServerHandler unsigned int maxSprite() const override final A_CONST A_WARN_UNUSED; - virtual void connect() = 0; + virtual void connect() const = 0; - void clear() override final; + void clear() const override final; protected: CharServerHandler(); diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 9b485c2d0..8ce8ec59d 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -41,7 +41,7 @@ ChatHandler::ChatHandler() ChatRecv::mSkipping = true; } -void ChatHandler::clear() +void ChatHandler::clear() const { ChatRecv::mShowMotd = config.getBoolValue("showmotd"); ChatRecv::mSkipping = true; diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h index cf0044fcd..9a67b79b1 100644 --- a/src/net/ea/chathandler.h +++ b/src/net/ea/chathandler.h @@ -42,7 +42,7 @@ class ChatHandler notfinal : public Net::ChatHandler void me(const std::string &restrict text, const std::string &restrict channel) const override final; - void clear() override final; + void clear() const override final; }; } // namespace Ea diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 782601b50..397e10a29 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -47,7 +47,7 @@ void GameHandler::setMap(const std::string &map) GameRecv::mMap = map.substr(0, map.rfind(".")); } -void GameHandler::clear() +void GameHandler::clear() const { GameRecv::mMap.clear(); GameRecv::mCharID = BeingId_zero; diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index a12a918cc..c18333ab5 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -40,9 +40,9 @@ class GameHandler notfinal : public Net::GameHandler bool removeDeadBeings() const override final A_WARN_UNUSED { return true; } - virtual void setMap(const std::string &map); + static void setMap(const std::string &map); - void clear() override final; + void clear() const override final; void initEngines() const override final; }; diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 81fc0103a..9a3b5a442 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -54,7 +54,7 @@ InventoryHandler::~InventoryHandler() delete2(InventoryRecv::mStorage); } -void InventoryHandler::clear() +void InventoryHandler::clear() const { delete2(InventoryRecv::mStorage); } @@ -98,7 +98,7 @@ size_t InventoryHandler::getSize(const InventoryTypeT type) const return 0; } } -void InventoryHandler::destroyStorage() +void InventoryHandler::destroyStorage() const { BLOCK_START("InventoryHandler::closeStorage") if (storageWindow) @@ -110,7 +110,7 @@ void InventoryHandler::destroyStorage() BLOCK_END("InventoryHandler::closeStorage") } -void InventoryHandler::forgotStorage() +void InventoryHandler::forgotStorage() const { storageWindow = nullptr; } diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 31a755b42..98a617c83 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -41,7 +41,7 @@ class InventoryHandler notfinal : public Net::InventoryHandler virtual ~InventoryHandler(); - void clear() override final; + void clear() const override final; bool canSplit(const Item *const item) const override final A_CONST A_WARN_UNUSED; @@ -55,11 +55,11 @@ class InventoryHandler notfinal : public Net::InventoryHandler size_t getSize(const InventoryTypeT type) const override final A_CONST A_WARN_UNUSED; - void pushPickup(const BeingId floorId); + static void pushPickup(const BeingId floorId); - void destroyStorage() override final; + void destroyStorage() const override final; - void forgotStorage() override final; + void forgotStorage() const override final; Inventory *getStorage() const override final; diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 20034f9f8..a3ebb8fb3 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -130,7 +130,7 @@ const Worlds &LoginHandler::getWorlds() const return LoginRecv::mWorlds; } -void LoginHandler::clearWorlds() +void LoginHandler::clearWorlds() const { delete_all(LoginRecv::mWorlds); LoginRecv::mWorlds.clear(); diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index b7b6136b5..7cd4c9c1b 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -56,7 +56,7 @@ class LoginHandler notfinal : public Net::LoginHandler const Worlds &getWorlds() const override final A_CONST A_WARN_UNUSED; - void clearWorlds() override final; + void clearWorlds() const override final; virtual ServerInfo *getCharServer() const A_WARN_UNUSED = 0; diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 6c7914a32..1b49e4c45 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -151,7 +151,7 @@ void AdminHandler::unequipAll(const Being *const being) const outMsg.writeBeingId(being->getId(), "account id"); } -void AdminHandler::requestStats(const std::string &name) +void AdminHandler::requestStats(const std::string &name) const { mStatsName = name; createOutPacket(CMSG_ADMIN_REQUEST_STATS); diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index bbd2dcadb..19f26db7e 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -69,7 +69,7 @@ class AdminHandler final : public Ea::AdminHandler void unequipAll(const Being *const being) const override final; - void requestStats(const std::string &name) override final; + void requestStats(const std::string &name) const override final; protected: static std::string mStatsName; diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 143d7dc9e..9e29f850f 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -72,7 +72,7 @@ void BeingHandler::requestRanks(const RankT rank) const outMsg.writeInt16(CAST_S16(rank), "type"); } -void BeingHandler::viewPlayerEquipment(const Being *const being) +void BeingHandler::viewPlayerEquipment(const Being *const being) const { if (!being) return; diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h index fd4afc6ac..439530dbd 100644 --- a/src/net/eathena/beinghandler.h +++ b/src/net/eathena/beinghandler.h @@ -43,8 +43,8 @@ class BeingHandler final : public Ea::BeingHandler void requestNameByCharId(const int id) const override final; - protected: - void viewPlayerEquipment(const Being *const being); + void viewPlayerEquipment(const Being *const being) const + override final; }; } // namespace EAthena diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 88db63c8f..c744fae34 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -107,7 +107,7 @@ void BeingRecv::processBeingChangeLookCards(Net::MessageIn &msg) FOR_EACH (Net::Characters::iterator, it, chars) { - Net::Character *character = *it; + const Net::Character *const character = *it; if (character->dummy && character->dummy->getId() == id) { dstBeing = character->dummy; @@ -137,12 +137,12 @@ void BeingRecv::processBeingChangeLookCards(Net::MessageIn &msg) processBeingChangeLookContinue(msg, dstBeing, type, id, id2, &cards[0]); } -void BeingRecv::processBeingChangeLookContinue(Net::MessageIn &msg, +void BeingRecv::processBeingChangeLookContinue(const Net::MessageIn &msg, Being *const dstBeing, const uint8_t type, const int id, const int id2, - const int *cards) + const int *const cards) { if (dstBeing->getType() == ActorType::Player) dstBeing->setOtherTime(); @@ -342,7 +342,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, CAST_U16( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); + const uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); if (dstBeing->getType() == ActorType::Player) { @@ -508,7 +508,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, CAST_U16( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); + const uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); if (dstBeing->getType() == ActorType::Player) { @@ -679,7 +679,7 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, CAST_U16( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); + const uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); if (dstBeing->getType() == ActorType::Player) { @@ -756,7 +756,7 @@ void BeingRecv::processMapTypeProperty(Net::MessageIn &msg) // +++ need get other flags from here MapTypeProperty2 props; props.data = CAST_U32(flags); - Game *const game = Game::instance(); + const Game *const game = Game::instance(); if (!game) return; Map *const map = game->getCurrentMap(); @@ -1230,7 +1230,7 @@ void BeingRecv::processPlaterStatusChange2(Net::MessageIn &msg) if (!dstBeing) return; - uint32_t statusEffects = msg.readInt32("status effect"); + const uint32_t statusEffects = msg.readInt32("status effect"); dstBeing->setLevel(msg.readInt32("level")); msg.readInt32("showEFST"); @@ -1715,7 +1715,7 @@ Being *BeingRecv::createBeing2(Net::MessageIn &msg, id, type, fromInt(job, BeingTypeId)); if (beingType == BeingType::MERSOL) { - MercenaryInfo *const info = PlayerInfo::getMercenary(); + const MercenaryInfo *const info = PlayerInfo::getMercenary(); if (info && info->id == id) PlayerInfo::setMercenaryBeing(being); } diff --git a/src/net/eathena/beingrecv.h b/src/net/eathena/beingrecv.h index 39a999da5..d2d0a749e 100644 --- a/src/net/eathena/beingrecv.h +++ b/src/net/eathena/beingrecv.h @@ -66,12 +66,13 @@ namespace EAthena void processSkillAutoCast(Net::MessageIn &msg); void processRanksList(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, const int id2, - const int *cards) A_NONNULL(2); + const int *const cards) + A_NONNULL(2); void processBeingSpecialEffect(Net::MessageIn &msg); void processBeingSpecialEffectNum(Net::MessageIn &msg); void processBeingSoundEffect(Net::MessageIn &msg); diff --git a/src/net/eathena/buyingstorerecv.cpp b/src/net/eathena/buyingstorerecv.cpp index cdb38c04b..3596638b6 100644 --- a/src/net/eathena/buyingstorerecv.cpp +++ b/src/net/eathena/buyingstorerecv.cpp @@ -121,7 +121,7 @@ void BuyingStoreRecv::processBuyingStoreItemsList(Net::MessageIn &msg) // +++ in future need use it too msg.readInt32("money limit"); - Being *const dstBeing = actorManager->findBeing(id); + const Being *const dstBeing = actorManager->findBeing(id); if (!dstBeing) return; @@ -129,7 +129,7 @@ void BuyingStoreRecv::processBuyingStoreItemsList(Net::MessageIn &msg) dstBeing->getId(), storeId); dialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); - Inventory *const inv = PlayerInfo::getInventory(); + const Inventory *const inv = PlayerInfo::getInventory(); for (int f = 0; f < count; f ++) { const int price = msg.readInt32("price"); diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index ce84840ca..328546909 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -57,7 +57,7 @@ CharServerHandler::CharServerHandler() : charServerHandler = this; } -void CharServerHandler::chooseCharacter(Net::Character *const character) +void CharServerHandler::chooseCharacter(Net::Character *const character) const { if (!character) return; @@ -100,7 +100,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot, } void CharServerHandler::deleteCharacter(Net::Character *const character, - const std::string &email) + const std::string &email) const { if (!character) return; @@ -122,7 +122,7 @@ void CharServerHandler::switchCharacter() const outMsg.writeInt8(1, "flag"); } -void CharServerHandler::connect() +void CharServerHandler::connect() const { const Token &token = static_cast<LoginHandler*>(loginHandler)->getToken(); @@ -144,6 +144,7 @@ void CharServerHandler::connect() } void CharServerHandler::setCharCreateDialog(CharCreateDialog *const window) + const { mCharCreateDialog = window; @@ -158,7 +159,7 @@ void CharServerHandler::setCharCreateDialog(CharCreateDialog *const window) mCharCreateDialog->setDefaultGender(token.sex); } -void CharServerHandler::setNewPincode(const std::string &pin A_UNUSED) +void CharServerHandler::setNewPincode(const std::string &pin A_UNUSED) const { // here need ecript pin with mPinSeed and pin values. @@ -168,7 +169,7 @@ void CharServerHandler::setNewPincode(const std::string &pin A_UNUSED) } void CharServerHandler::renameCharacter(const BeingId id, - const std::string &newName) + const std::string &newName) const { createOutPacket(CMSG_CHAR_CHECK_RENAME); CharServerRecv::mRenameId = id; @@ -177,7 +178,8 @@ void CharServerHandler::renameCharacter(const BeingId id, outMsg.writeString(newName, 24, "name"); } -void CharServerHandler::changeSlot(const int oldSlot, const int newSlot) +void CharServerHandler::changeSlot(const int oldSlot, + const int newSlot) const { createOutPacket(CMSG_CHAR_CHANGE_SLOT); outMsg.writeInt16(CAST_S16(oldSlot), "old slot"); diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index 632012e5d..833c5d6ad 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/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,28 +51,30 @@ class CharServerHandler final : public Ea::CharServerHandler const std::vector<int> &stats) const override final; void renameCharacter(const BeingId id, - const std::string &newName) override final; + const std::string &newName) const override final; void deleteCharacter(Net::Character *const character, - const std::string &email) override final; + const std::string &email) const override final; void switchCharacter() const override final; - void connect() override final; + void connect() const override final; bool isNeedCreatePin() const override final A_WARN_UNUSED; - void setNewPincode(const std::string &pin) override final A_CONST; + void setNewPincode(const std::string &pin) const override final + A_CONST; /** * Sets the character create dialog. The handler will clean up this * 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; + void changeSlot(const int oldSlot, + const int newSlot) const override final; void ping() const override final; diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 6efbb7864..9653384c3 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -72,7 +72,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 + 1), "len"); @@ -83,7 +83,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 { privateMessage(channel, text); } @@ -198,7 +198,7 @@ void ChatHandler::requestIgnoreList() const void ChatHandler::createChatRoom(const std::string &title, const std::string &password, const int limit, - const bool isPublic) + const bool isPublic) const { createOutPacket(CMSG_CREAYE_CHAT_ROOM); outMsg.writeInt16(CAST_S16( @@ -248,7 +248,7 @@ void ChatHandler::joinChannel(const std::string &channel) } } -void ChatHandler::partChannel(const std::string &channel) +void ChatHandler::partChannel(const std::string &channel) const { if (serverFeatures->haveJoinChannel()) { diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index bb919062e..ed9183465 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/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; @@ -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; + const bool isPublic) const override final; void ignore(const std::string &nick) const override final; @@ -73,7 +75,7 @@ class ChatHandler final : public Ea::ChatHandler void joinChat(const ChatObject *const chat, const std::string &password) const override final; - void partChannel(const std::string &channel) override final; + void partChannel(const std::string &channel) const override final; void talkPet(const std::string &restrict text, const std::string &restrict channel) const override final; diff --git a/src/net/eathena/chatrecv.cpp b/src/net/eathena/chatrecv.cpp index 5846d36c6..553fb748e 100644 --- a/src/net/eathena/chatrecv.cpp +++ b/src/net/eathena/chatrecv.cpp @@ -108,7 +108,7 @@ void ChatRecv::processIgnoreNickAck(Net::MessageIn &msg) void ChatRecv::processChat(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") @@ -160,8 +160,8 @@ void ChatRecv::processFormatMessage(Net::MessageIn &msg) void ChatRecv::processFormatMessageNumber(Net::MessageIn &msg) { - int msgId = msg.readInt16("msg id"); - int value = msg.readInt32("value"); + const int msgId = msg.readInt16("msg id"); + const int value = msg.readInt32("value"); if (msgId == 1862) { NotifyManager::notify(NotifyTypes::USE_ITEM_WAIT, value); @@ -240,7 +240,7 @@ std::string ChatRecv::extractChannelFromMessage(std::string &chatMsg) } void ChatRecv::processChatContinue(std::string chatMsg, - ChatMsgTypeT own) + const ChatMsgTypeT own) { const std::string channel = extractChannelFromMessage(chatMsg); bool allow(true); @@ -270,7 +270,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") @@ -380,7 +380,7 @@ void ChatRecv::processChatRoomJoinAck(Net::MessageIn &msg) msg.readString(24, "name"); } - ChatObject *oldChat = ChatObject::findById(id); + const ChatObject *const oldChat = ChatObject::findById(id); if (oldChat) PlayerInfo::setRoomName(oldChat->title); @@ -441,7 +441,7 @@ void ChatRecv::processJoinChannel(Net::MessageIn &msg) return; const std::string channel = msg.readString(24, "channel name"); - int flag = msg.readUInt8("flag"); + const int flag = msg.readUInt8("flag"); if (channel.size() < 2) return; @@ -497,7 +497,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; Being *const being = actorManager->findBeing(msg.readBeingId("being id")); if (chatMsgLength <= 0) diff --git a/src/net/eathena/chatrecv.h b/src/net/eathena/chatrecv.h index bcc04f54d..d1845b0d3 100644 --- a/src/net/eathena/chatrecv.h +++ b/src/net/eathena/chatrecv.h @@ -40,7 +40,7 @@ namespace EAthena void processChat(Net::MessageIn &msg); void processColorChat(Net::MessageIn &msg); void processChatContinue(std::string chatMsg, - ChatMsgTypeT own); + const ChatMsgTypeT own); void processWhisper(Net::MessageIn &msg); void processWhisperResponse(Net::MessageIn &msg); void processGmChat(Net::MessageIn &msg); diff --git a/src/net/eathena/familyhandler.cpp b/src/net/eathena/familyhandler.cpp index ec22a7097..961d8877d 100644 --- a/src/net/eathena/familyhandler.cpp +++ b/src/net/eathena/familyhandler.cpp @@ -41,7 +41,7 @@ FamilyHandler::FamilyHandler() familyHandler = this; } -void FamilyHandler::askForChild(const Being *const being) +void FamilyHandler::askForChild(const Being *const being) const { if (!being) return; @@ -50,7 +50,7 @@ void FamilyHandler::askForChild(const Being *const being) outMsg.writeBeingId(being->getId(), "account id"); } -void FamilyHandler::askForChildReply(const bool accept) +void FamilyHandler::askForChildReply(const bool accept) const { createOutPacket(CMSG_FAMILY_ASK_FOR_CHILD_REPLY); outMsg.writeInt32(FamilyRecv::mParent1, "parent1"); diff --git a/src/net/eathena/familyhandler.h b/src/net/eathena/familyhandler.h index 657a1e8dc..0865dcdf9 100644 --- a/src/net/eathena/familyhandler.h +++ b/src/net/eathena/familyhandler.h @@ -34,9 +34,9 @@ class FamilyHandler final : public Net::FamilyHandler A_DELETE_COPY(FamilyHandler) - void askForChild(const Being *const being) override final; + void askForChild(const Being *const being) const override final; - void askForChildReply(const bool accept) override final; + void askForChildReply(const bool accept) const override final; }; } // namespace EAthena diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index a380f43e5..0a97aa6f1 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -57,7 +57,7 @@ void GameHandler::mapLoadedEvent() const createOutPacket(CMSG_MAP_LOADED); } -void GameHandler::connect() +void GameHandler::connect() const { if (!Network::mInstance) return; @@ -108,7 +108,7 @@ bool GameHandler::isConnected() const return Network::mInstance->isConnected(); } -void GameHandler::disconnect() +void GameHandler::disconnect() const { if (Network::mInstance) Network::mInstance->disconnect(); diff --git a/src/net/eathena/gamehandler.h b/src/net/eathena/gamehandler.h index 4fd98ef4f..3d10124d7 100644 --- a/src/net/eathena/gamehandler.h +++ b/src/net/eathena/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/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index cdc2b2673..5d9bb790b 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -140,7 +140,7 @@ GeneralHandler::~GeneralHandler() delete2(Network::mInstance); } -void GeneralHandler::load() +void GeneralHandler::load() const { new Network; Network::mInstance->registerHandlers(); @@ -169,7 +169,7 @@ void GeneralHandler::unload() clearHandlers(); } -void GeneralHandler::flushSend() +void GeneralHandler::flushSend() const { if (!Network::mInstance) return; @@ -177,7 +177,7 @@ void GeneralHandler::flushSend() Network::mInstance->flush(); } -void GeneralHandler::flushNetwork() +void GeneralHandler::flushNetwork() const { if (!Network::mInstance) return; @@ -201,7 +201,7 @@ void GeneralHandler::flushNetwork() } } -void GeneralHandler::clearHandlers() +void GeneralHandler::clearHandlers() const { if (Network::mInstance) Network::mInstance->clearHandlers(); diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h index 9d998330a..42080f3a9 100644 --- a/src/net/eathena/generalhandler.h +++ b/src/net/eathena/generalhandler.h @@ -72,17 +72,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/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index bc4d70f57..3da443dda 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -142,7 +142,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/eathena/guildhandler.h b/src/net/eathena/guildhandler.h index b107b51ae..3ff9d5042 100644 --- a/src/net/eathena/guildhandler.h +++ b/src/net/eathena/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/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index d3b969143..68663112e 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -156,7 +156,7 @@ void InventoryRecv::processPlayerInventoryAdd(Net::MessageIn &msg) const int index = msg.readInt16("index") - INVENTORY_OFFSET; int amount = msg.readInt16("count"); const int itemId = msg.readInt16("item id"); - uint8_t identified = msg.readUInt8("identified"); + const uint8_t identified = msg.readUInt8("identified"); const uint8_t damaged = msg.readUInt8("is damaged"); const uint8_t refine = msg.readUInt8("refine"); int cards[maxCards]; @@ -733,7 +733,7 @@ void InventoryRecv::processPlayerCartAdd(Net::MessageIn &msg) int amount = msg.readInt32("count"); const int itemId = msg.readInt16("item id"); const int itemType = msg.readUInt8("item type"); - uint8_t identified = msg.readUInt8("identified"); + const uint8_t identified = msg.readUInt8("identified"); const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged); const uint8_t refine = msg.readUInt8("refine"); int cards[maxCards]; @@ -1058,7 +1058,7 @@ void InventoryRecv::processBindItem(Net::MessageIn &msg) if (inv) { std::string itemName; - const Item *item = inv->getItem(index); + const Item *const item = inv->getItem(index); if (item) { itemName = item->getName(); diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index 79e75be2b..a7bcd5406 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -50,7 +50,7 @@ LoginHandler::~LoginHandler() { } -void LoginHandler::connect() +void LoginHandler::connect() const { if (!Network::mInstance) return; @@ -75,7 +75,7 @@ bool LoginHandler::isConnected() const return 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/eathena/loginhandler.h b/src/net/eathena/loginhandler.h index b1e52c260..19a8a3f3c 100644 --- a/src/net/eathena/loginhandler.h +++ b/src/net/eathena/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/eathena/mailrecv.cpp b/src/net/eathena/mailrecv.cpp index d920d98c5..e89c730e9 100644 --- a/src/net/eathena/mailrecv.cpp +++ b/src/net/eathena/mailrecv.cpp @@ -90,7 +90,7 @@ void MailRecv::processMailList(Net::MessageIn &msg) void MailRecv::processReadMail(Net::MessageIn &msg) { const int sz = msg.readInt16("len") - 101; - MailMessage *mail = new MailMessage; + MailMessage *const mail = new MailMessage; mail->id = msg.readInt32("message id"); mail->title = msg.readString(40, "title"); mail->sender = msg.readString(24, "sender name"); diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp index c019c6251..6c69664ea 100644 --- a/src/net/eathena/markethandler.cpp +++ b/src/net/eathena/markethandler.cpp @@ -39,7 +39,7 @@ MarketHandler::MarketHandler() MarketRecv::mBuyDialog = nullptr; } -void MarketHandler::close() +void MarketHandler::close() const { createOutPacket(CMSG_NPC_MARKET_CLOSE); } diff --git a/src/net/eathena/markethandler.h b/src/net/eathena/markethandler.h index e99aa6bc9..8ba0be922 100644 --- a/src/net/eathena/markethandler.h +++ b/src/net/eathena/markethandler.h @@ -33,7 +33,7 @@ class MarketHandler final : public Net::MarketHandler A_DELETE_COPY(MarketHandler) - void close() override final; + void close() const override final; void buyItem(const int itemId, const int type, diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp index 84eb5671c..a6043100b 100644 --- a/src/net/eathena/mercenaryhandler.cpp +++ b/src/net/eathena/mercenaryhandler.cpp @@ -39,7 +39,7 @@ MercenaryHandler::MercenaryHandler() mercenaryHandler = this; } -void MercenaryHandler::fire() +void MercenaryHandler::fire() const { createOutPacket(CMSG_MERCENARY_ACTION); outMsg.writeInt8(2, "action"); // delete diff --git a/src/net/eathena/mercenaryhandler.h b/src/net/eathena/mercenaryhandler.h index f6d70b40f..d6eddd75b 100644 --- a/src/net/eathena/mercenaryhandler.h +++ b/src/net/eathena/mercenaryhandler.h @@ -32,7 +32,7 @@ class MercenaryHandler final : public Net::MercenaryHandler A_DELETE_COPY(MercenaryHandler) - void fire() override final; + void fire() const override final; void moveToMaster() const override final; diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 934afe9f8..722d7f76b 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -147,7 +147,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/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp index 55f285dc1..06e9985fe 100644 --- a/src/net/eathena/pethandler.cpp +++ b/src/net/eathena/pethandler.cpp @@ -56,7 +56,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) { createOutPacket(CMSG_PET_EMOTE); outMsg.writeInt8(emoteId, "emote id"); diff --git a/src/net/eathena/petrecv.cpp b/src/net/eathena/petrecv.cpp index 284ada80b..da209e268 100644 --- a/src/net/eathena/petrecv.cpp +++ b/src/net/eathena/petrecv.cpp @@ -54,7 +54,7 @@ void PetRecv::processPetMessage(Net::MessageIn &msg) { const BeingId id = msg.readBeingId("pet id"); const int data = msg.readInt32("param"); - Being *const dstBeing = actorManager->findBeing(id); + const Being *const dstBeing = actorManager->findBeing(id); if (!dstBeing) return; @@ -98,7 +98,7 @@ void PetRecv::processPetRoulette(Net::MessageIn &msg) void PetRecv::processEggsList(Net::MessageIn &msg) { const int count = (msg.readInt16("len") - 4) / 2; - Inventory *const inv = PlayerInfo::getInventory(); + const Inventory *const inv = PlayerInfo::getInventory(); if (!inv) return; menu = MenuType::Eggs; diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index 928faf45b..af35c2248 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -391,11 +391,11 @@ void PlayerRecv::processOnlineList(Net::MessageIn &msg) while (buf - start + 1 < size && *(buf + CAST_SIZE(addVal))) { - unsigned char status = *buf; + const unsigned char status = *buf; buf ++; - unsigned char level = *buf; + const unsigned char level = *buf; buf ++; - unsigned char ver = *buf; + const unsigned char ver = *buf; buf ++; GenderT gender = Gender::UNSPECIFIED; diff --git a/src/net/eathena/skillrecv.cpp b/src/net/eathena/skillrecv.cpp index 3301543cd..66450cccc 100644 --- a/src/net/eathena/skillrecv.cpp +++ b/src/net/eathena/skillrecv.cpp @@ -220,7 +220,7 @@ void SkillRecv::processSkillFailed(Net::MessageIn &msg) localPlayer->stopAdvert(); } - SkillInfo *const info = skillDialog->getSkill(bskill); + const SkillInfo *const info = skillDialog->getSkill(bskill); if (info) { txt = info->errorText; @@ -233,7 +233,7 @@ void SkillRecv::processSkillFailed(Net::MessageIn &msg) } else { - SkillInfo *const info = skillDialog->getSkill(skillId); + const SkillInfo *const info = skillDialog->getSkill(skillId); if (info) { txt = info->errorText + "."; diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp index 00618d53d..0e6c33434 100644 --- a/src/net/eathena/vendingrecv.cpp +++ b/src/net/eathena/vendingrecv.cpp @@ -81,7 +81,7 @@ void VendingRecv::processItemsList(Net::MessageIn &msg) { const int count = (msg.readInt16("len") - 12) / 22; const BeingId id = msg.readBeingId("id"); - Being *const being = actorManager->findBeing(id); + const Being *const being = actorManager->findBeing(id); if (!being) return; int cards[maxCards]; diff --git a/src/net/familyhandler.h b/src/net/familyhandler.h index 02a6294a6..e7e47be3b 100644 --- a/src/net/familyhandler.h +++ b/src/net/familyhandler.h @@ -38,9 +38,9 @@ class FamilyHandler notfinal virtual ~FamilyHandler() { } - virtual void askForChild(const Being *const being) = 0; + virtual void askForChild(const Being *const being) const = 0; - virtual void askForChildReply(const bool accept) = 0; + virtual void askForChildReply(const bool accept) const = 0; }; } // namespace Net diff --git a/src/net/gamehandler.h b/src/net/gamehandler.h index bd5d96664..fb41db678 100644 --- a/src/net/gamehandler.h +++ b/src/net/gamehandler.h @@ -34,11 +34,11 @@ class GameHandler notfinal virtual ~GameHandler() {} - virtual void connect() = 0; + virtual void connect() const = 0; virtual bool isConnected() const = 0; - virtual void disconnect() = 0; + virtual void disconnect() const = 0; virtual void who() const = 0; @@ -56,7 +56,7 @@ class GameHandler notfinal virtual void initEngines() const = 0; - virtual void clear() = 0; + virtual void clear() const = 0; }; } // namespace Net diff --git a/src/net/generalhandler.h b/src/net/generalhandler.h index 96d778c2c..9e6a20ff3 100644 --- a/src/net/generalhandler.h +++ b/src/net/generalhandler.h @@ -34,17 +34,17 @@ class GeneralHandler notfinal virtual ~GeneralHandler() { } - virtual void load() = 0; + virtual void load() const = 0; virtual void reload() = 0; virtual void unload() = 0; - virtual void flushNetwork() = 0; + virtual void flushNetwork() const = 0; - virtual void flushSend() = 0; + virtual void flushSend() const = 0; - virtual void clearHandlers() = 0; + virtual void clearHandlers() const = 0; virtual void reloadPartially() const = 0; diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index b823bd70c..c6152c6af 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.h @@ -56,7 +56,7 @@ class GuildHandler notfinal virtual void memberList() const = 0; - virtual void info() = 0; + virtual void info() const = 0; virtual void changeMemberPostion(const GuildMember *const member, const int level) const = 0; diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h index 77d2a526f..d47b32097 100644 --- a/src/net/inventoryhandler.h +++ b/src/net/inventoryhandler.h @@ -36,7 +36,7 @@ class InventoryHandler notfinal virtual ~InventoryHandler() { } - virtual void clear() = 0; + virtual void clear() const = 0; virtual void equipItem(const Item *const item) const = 0; @@ -67,9 +67,9 @@ class InventoryHandler notfinal virtual Inventory *getStorage() const = 0; - virtual void destroyStorage() = 0; + virtual void destroyStorage() const = 0; - virtual void forgotStorage() = 0; + virtual void forgotStorage() const = 0; virtual int convertFromServerSlot(const int eAthenaSlot) const = 0; diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index b906a3de7..95fcf887b 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -40,11 +40,11 @@ class LoginHandler notfinal const ServerInfo &getServer() const A_WARN_UNUSED { return mServer; } - virtual void connect() = 0; + virtual void connect() const = 0; virtual bool isConnected() const A_WARN_UNUSED = 0; - virtual void disconnect() = 0; + virtual void disconnect() const = 0; virtual bool isRegistrationEnabled() const A_WARN_UNUSED = 0; @@ -83,7 +83,7 @@ class LoginHandler notfinal virtual const Worlds &getWorlds() const A_WARN_UNUSED = 0; - virtual void clearWorlds() = 0; + virtual void clearWorlds() const = 0; virtual void loginOrRegister(LoginData *const data) const = 0; diff --git a/src/net/markethandler.h b/src/net/markethandler.h index 88a18601e..856014686 100644 --- a/src/net/markethandler.h +++ b/src/net/markethandler.h @@ -41,7 +41,7 @@ class MarketHandler notfinal virtual ~MarketHandler() { } - virtual void close() = 0; + virtual void close() const = 0; virtual void buyItem(const int itemId, const int type, diff --git a/src/net/mercenaryhandler.h b/src/net/mercenaryhandler.h index f4cf1ce5a..83ec9c94b 100644 --- a/src/net/mercenaryhandler.h +++ b/src/net/mercenaryhandler.h @@ -39,7 +39,7 @@ class MercenaryHandler notfinal virtual ~MercenaryHandler() { } - virtual void fire() = 0; + virtual void fire() const = 0; virtual void moveToMaster() const = 0; diff --git a/src/net/pethandler.h b/src/net/pethandler.h index 0df7f257d..5c9099afa 100644 --- a/src/net/pethandler.h +++ b/src/net/pethandler.h @@ -39,7 +39,8 @@ class PetHandler notfinal const int petId, const int x, const int y) const = 0; - virtual void emote(const uint8_t emoteId, const int petId) = 0; + virtual void emote(const uint8_t emoteId, + const int petId) = 0; virtual void catchPet(const Being *const being) const = 0; 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*>(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<int> &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) |