From 3f76d07b673de76d7c4e434bd5a214f3480927cb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 2 Feb 2014 12:48:01 +0300 Subject: Add missing const and static into being classes. --- src/being/being.cpp | 7 +++---- src/being/being.h | 7 ++++--- src/being/localplayer.cpp | 4 ++-- src/being/localplayer.h | 13 +++++++------ src/being/playerrelations.cpp | 2 +- src/being/playerrelations.h | 2 +- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index f9667ca33..fef3ca53a 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2964,7 +2964,7 @@ int Being::searchSlotValue(const std::vector &slotRemap, void Being::searchSlotValueItr(std::vector::iterator &it, int &idx, std::vector &slotRemap, - const int val) const + const int val) { // logger->log("searching %d", val); it = slotRemap.begin(); @@ -3052,7 +3052,7 @@ std::string Being::loadComment(const std::string &name, const int type) str.append(stringToHexPath(name)).append("/comment.txt"); const ResourceManager *const resman = ResourceManager::getInstance(); - if (resman->existsLocal(str)) + if (ResourceManager::existsLocal(str)) { StringVect lines; resman->loadTextFileLocal(str, lines); @@ -3078,8 +3078,7 @@ void Being::saveComment(const std::string &restrict name, return; } dir.append(stringToHexPath(name)); - const ResourceManager *const resman = ResourceManager::getInstance(); - resman->saveTextFile(dir, "comment.txt", + ResourceManager::saveTextFile(dir, "comment.txt", (name + "\n").append(comment)); } diff --git a/src/being/being.h b/src/being/being.h index d3dfe2cc1..b9039bce3 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1025,9 +1025,10 @@ class Being : public ActorSprite, public ConfigListener int searchSlotValue(const std::vector &slotRemap, const int val) const A_WARN_UNUSED; - void searchSlotValueItr(std::vector::iterator &it, int &idx, - std::vector &slotRemap, - const int val) const; + static void searchSlotValueItr(std::vector::iterator &it, + int &idx, + std::vector &slotRemap, + const int val); void dumpSprites() const; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 41688cbf3..529f2c73a 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -3229,7 +3229,7 @@ void LocalPlayer::specialMove(const unsigned char direction) } } -void LocalPlayer::debugMsg(const std::string &str) const +void LocalPlayer::debugMsg(const std::string &str) { if (debugChatTab) debugChatTab->chatLog(str); @@ -4317,7 +4317,7 @@ bool LocalPlayer::checAttackPermissions(const Being *const target) const const char *LocalPlayer::getVarItem(const char *const *const arr, const unsigned index, - const unsigned sz) const + const unsigned sz) { if (index < sz) return arr[index]; diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 88a6f6754..c8fa5a32a 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -297,7 +297,7 @@ class LocalPlayer final : public Being, void moveToHome(); - void debugMsg(const std::string &str) const; + static void debugMsg(const std::string &str); bool isReachable(Being *const being, const int maxCost = 0) A_WARN_UNUSED; @@ -331,7 +331,7 @@ class LocalPlayer final : public Being, void afkRespond(ChatTab *const tab, const std::string &nick); - void setAfkMessage(std::string message); + static void setAfkMessage(std::string message); bool navigateTo(const int x, const int y); @@ -522,11 +522,12 @@ class LocalPlayer final : public Being, static void tryMagic(const std::string &spell, const int baseMagic, const int schoolMagic, const int mana); - const char *getVarItem(const char *const *const arr, - const unsigned index, - const unsigned sz) const A_WARN_UNUSED; + static const char *getVarItem(const char *const *const arr, + const unsigned index, + const unsigned sz) A_WARN_UNUSED; - void changeMode(unsigned *restrict const var, const unsigned limit, + void changeMode(unsigned *restrict const var, + const unsigned limit, const char *restrict const conf, std::string (LocalPlayer::*const func)(), const unsigned def = 0, diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index f3e921be3..a04c77e76 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -600,7 +600,7 @@ bool PlayerRelationsManager::isGoodName(Being *const being) const return status; } -bool PlayerRelationsManager::checkName(const std::string &name) const +bool PlayerRelationsManager::checkName(const std::string &name) { const size_t size = name.size(); const std::string check = config.getStringValue("unsecureChars"); diff --git a/src/being/playerrelations.h b/src/being/playerrelations.h index f37e33d89..200cdf311 100644 --- a/src/being/playerrelations.h +++ b/src/being/playerrelations.h @@ -270,7 +270,7 @@ class PlayerRelationsManager final // ignored data upon reloading unsigned int mDefaultPermissions; - bool checkName(const std::string &name) const A_WARN_UNUSED; + static bool checkName(const std::string &name) A_WARN_UNUSED; PlayerIgnoreStrategy *mIgnoreStrategy; std::map mRelations; -- cgit v1.2.3-60-g2f50