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/eathena/adminhandler.cpp | 2 +- src/net/eathena/adminhandler.h | 2 +- src/net/eathena/beinghandler.cpp | 2 +- src/net/eathena/beinghandler.h | 4 ++-- src/net/eathena/beingrecv.cpp | 18 +++++++++--------- src/net/eathena/beingrecv.h | 5 +++-- src/net/eathena/buyingstorerecv.cpp | 4 ++-- src/net/eathena/charserverhandler.cpp | 14 ++++++++------ src/net/eathena/charserverhandler.h | 17 ++++++++++------- src/net/eathena/chathandler.cpp | 8 ++++---- src/net/eathena/chathandler.h | 10 ++++++---- src/net/eathena/chatrecv.cpp | 16 ++++++++-------- src/net/eathena/chatrecv.h | 2 +- src/net/eathena/familyhandler.cpp | 4 ++-- src/net/eathena/familyhandler.h | 4 ++-- src/net/eathena/gamehandler.cpp | 4 ++-- src/net/eathena/gamehandler.h | 4 ++-- src/net/eathena/generalhandler.cpp | 8 ++++---- src/net/eathena/generalhandler.h | 8 ++++---- src/net/eathena/guildhandler.cpp | 2 +- src/net/eathena/guildhandler.h | 2 +- src/net/eathena/inventoryrecv.cpp | 6 +++--- src/net/eathena/loginhandler.cpp | 4 ++-- src/net/eathena/loginhandler.h | 4 ++-- src/net/eathena/mailrecv.cpp | 2 +- src/net/eathena/markethandler.cpp | 2 +- src/net/eathena/markethandler.h | 2 +- src/net/eathena/mercenaryhandler.cpp | 2 +- src/net/eathena/mercenaryhandler.h | 2 +- src/net/eathena/network.cpp | 2 +- src/net/eathena/pethandler.cpp | 3 ++- src/net/eathena/petrecv.cpp | 4 ++-- src/net/eathena/playerrecv.cpp | 6 +++--- src/net/eathena/skillrecv.cpp | 4 ++-- src/net/eathena/vendingrecv.cpp | 2 +- 35 files changed, 97 insertions(+), 88 deletions(-) (limited to 'src/net/eathena') 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)->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 &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]; -- cgit v1.2.3-70-g09d2