From e85c6227064c905945a4d49a5e11a0078243a1ac Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 18 Sep 2013 18:56:46 +0300 Subject: add missing const in being classes. --- src/being/being.cpp | 11 ++++++----- src/being/being.h | 6 +++--- src/being/localplayer.cpp | 10 ++++++---- src/being/localplayer.h | 4 ++-- src/being/playerrelations.cpp | 2 +- src/being/playerrelations.h | 2 +- 6 files changed, 19 insertions(+), 16 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index 2e7f6d67b..3f40398a0 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -648,7 +648,8 @@ int Being::getHitEffect(const Being *const attacker, { if (attacker) { - const ItemInfo *attackerWeapon = attacker->getEquippedWeapon(); + const ItemInfo *const attackerWeapon + = attacker->getEquippedWeapon(); if (attackerWeapon && attacker->getType() == PLAYER) { if (type == MISS) @@ -663,7 +664,7 @@ int Being::getHitEffect(const Being *const attacker, const BeingInfo *const info = attacker->getInfo(); if (info) { - const Attack *atk = info->getAttack(attackId); + const Attack *const atk = info->getAttack(attackId); if (atk) { if (type == MISS) @@ -768,7 +769,7 @@ void Being::handleSkill(Being *const victim, const int damage, if (this != player_node) setAction(Being::ATTACK, 1); - SkillInfo *const skill = skillDialog->getSkill(skillId); + const SkillInfo *const skill = skillDialog->getSkill(skillId); const SkillData *const data = skill ? skill->getData1(skillLevel) : nullptr; if (data) @@ -1584,7 +1585,7 @@ void Being::logic() } void Being::drawEmotion(Graphics *const graphics, const int offsetX, - const int offsetY) + const int offsetY) const { const int px = getPixelX() - offsetX - 16; const int py = getPixelY() - offsetY - 64 - 32; @@ -3028,7 +3029,7 @@ void Being::updatePets() } void Being::playSfx(const SoundInfo &sound, Being *const being, - const bool main, const int x, const int y) + const bool main, const int x, const int y) const { if (being) { diff --git a/src/being/being.h b/src/being/being.h index 8d7db49a5..1668d17eb 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -412,7 +412,7 @@ class Being : public ActorSprite, public ConfigListener * Draws the emotion picture above the being. */ void drawEmotion(Graphics *const graphics, const int offsetX, - const int offsetY); + const int offsetY) const; uint16_t getSubType() const { return mSubType; } @@ -878,9 +878,9 @@ class Being : public ActorSprite, public ConfigListener { mOwner = owner; } void playSfx(const SoundInfo &sound, Being *const being, - const bool main, const int x, const int y); + const bool main, const int x, const int y) const; - int getLook() + int getLook() const { return mLook; } void setLook(const int look); diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 2179dc318..4d42bc717 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -357,7 +357,8 @@ void LocalPlayer::slowLogic() if (mTestParticleTime != time && !mTestParticleName.empty()) { - unsigned long hash = UpdaterWindow::getFileHash(mTestParticleName); + const unsigned long hash = UpdaterWindow::getFileHash( + mTestParticleName); if (hash != mTestParticleHash) { setTestParticle(mTestParticleName, false); @@ -803,7 +804,7 @@ void LocalPlayer::nextTile(unsigned char dir A_UNUSED = 0) if (Net::getNetworkType() != ServerInfo::MANASERV) #endif { - Party *const party = Party::getParty(1); + const Party *const party = Party::getParty(1); if (party) { PartyMember *const pm = party->getMember(getName()); @@ -1596,7 +1597,7 @@ void LocalPlayer::optionChanged(const std::string &value) mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable"); } -void LocalPlayer::processEvent(Channels channel, +void LocalPlayer::processEvent(const Channels channel, const DepricatedEvent &event) { if (channel == CHANNEL_ATTRIBUTES) @@ -4313,7 +4314,8 @@ void LocalPlayer::updateStatus() const } } -void LocalPlayer::setTestParticle(const std::string &fileName, bool updateHash) +void LocalPlayer::setTestParticle(const std::string &fileName, + const bool updateHash) { mTestParticleName = fileName; mTestParticleTime = cur_time; diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 5e0cf9ea6..abc4644e2 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -374,7 +374,7 @@ class LocalPlayer final : public Being, */ void optionChanged(const std::string &value) override; - void processEvent(Channels channel, + void processEvent(const Channels channel, const DepricatedEvent &event) override; /** @@ -468,7 +468,7 @@ class LocalPlayer final : public Being, void updateStatus() const; void setTestParticle(const std::string &fileName, - bool updateHash = true); + const bool updateHash = true); std::string getInvertDirectionString(); diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index 3ae58a411..7e5807166 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -414,7 +414,7 @@ void PlayerRelationsManager::setDefault(const unsigned int permissions) signalUpdate(""); } -void PlayerRelationsManager::ignoreTrade(const std::string &name) +void PlayerRelationsManager::ignoreTrade(const std::string &name) const { if (name.empty()) return; diff --git a/src/being/playerrelations.h b/src/being/playerrelations.h index f7e9eba60..5d11b5b25 100644 --- a/src/being/playerrelations.h +++ b/src/being/playerrelations.h @@ -240,7 +240,7 @@ class PlayerRelationsManager final bool getPersistIgnores() const { return mPersistIgnores; } - void ignoreTrade(const std::string &name); + void ignoreTrade(const std::string &name) const; bool isGoodName(Being *const being) const A_WARN_UNUSED; -- cgit v1.2.3-60-g2f50