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/actorspritemanager.cpp | 1 + src/actorspritemanager.h | 2 +- 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 +- src/depricatedlistener.h | 2 +- src/gui/chatwindow.cpp | 3 ++- src/gui/chatwindow.h | 2 +- src/gui/inventorywindow.cpp | 2 +- src/gui/inventorywindow.h | 2 +- src/gui/killstats.cpp | 2 +- src/gui/killstats.h | 2 +- src/gui/ministatuswindow.cpp | 2 +- src/gui/ministatuswindow.h | 2 +- src/gui/statuswindow.cpp | 2 +- src/gui/statuswindow.h | 2 +- 19 files changed, 33 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index bd3cd498c..3c23bccbe 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -1654,6 +1654,7 @@ bool ActorSpriteManager::checkForPickup(const FloorItem *const item) const void ActorSpriteManager::updateEffects(const std::map &addEffects, const std::set &removeEffects) + const { for_actors { diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h index 74ddd7a32..0e3319394 100644 --- a/src/actorspritemanager.h +++ b/src/actorspritemanager.h @@ -301,7 +301,7 @@ class ActorSpriteManager final: public ConfigListener bool checkForPickup(const FloorItem *const item) const A_WARN_UNUSED; void updateEffects(const std::map &addEffects, - const std::set &removeEffects); + const std::set &removeEffects) const; protected: bool validateBeing(const Being *const aroundBeing, 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; diff --git a/src/depricatedlistener.h b/src/depricatedlistener.h index 4316056d2..34470a36b 100644 --- a/src/depricatedlistener.h +++ b/src/depricatedlistener.h @@ -33,7 +33,7 @@ class DepricatedListener void ignore(Channels channel); - virtual void processEvent(Channels channel, + virtual void processEvent(const Channels channel, const DepricatedEvent &event) = 0; }; diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index f87d9c3bc..c9690cb86 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -917,7 +917,8 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) addInputText(temp, false); } -void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event) +void ChatWindow::processEvent(const Channels channel, + const DepricatedEvent &event) { if (channel == CHANNEL_ATTRIBUTES) { diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 0bf195fc0..195c7cba0 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -194,7 +194,7 @@ class ChatWindow final : public Window, */ void mousePressed(gcn::MouseEvent &event) override; - void processEvent(Channels channel, + void processEvent(const Channels channel, const DepricatedEvent &event) override; /** diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index ec26e1b9e..4129cc981 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -711,7 +711,7 @@ void InventoryWindow::close() } } -void InventoryWindow::processEvent(Channels channel A_UNUSED, +void InventoryWindow::processEvent(const Channels channel A_UNUSED, const DepricatedEvent &event) { if (event.getName() == EVENT_UPDATEATTRIBUTE) diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index eec3ba855..7bd4ce466 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -133,7 +133,7 @@ class InventoryWindow final : public Window, void updateDropButton(); - void processEvent(Channels channel, + void processEvent(const Channels channel, const DepricatedEvent &event) override; void updateButtons(const Item *item = nullptr); diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index a8c82ec40..a5e70a30d 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -484,7 +484,7 @@ void KillStats::validateJacko() } } -void KillStats::processEvent(Channels channel A_UNUSED, +void KillStats::processEvent(const Channels channel A_UNUSED, const DepricatedEvent &event) { if (event.getName() == EVENT_UPDATEATTRIBUTE) diff --git a/src/gui/killstats.h b/src/gui/killstats.h index ea4d89582..a5b59affb 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -75,7 +75,7 @@ class KillStats final : public Window, void jackoAlive(const int id); - void processEvent(Channels channel A_UNUSED, + void processEvent(const Channels channel A_UNUSED, const DepricatedEvent &event) override; void resetTimes(); diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index ba87b4984..1119d2519 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -223,7 +223,7 @@ void MiniStatusWindow::drawIcons(Graphics *const graphics) } } -void MiniStatusWindow::processEvent(Channels channel A_UNUSED, +void MiniStatusWindow::processEvent(const Channels channel A_UNUSED, const DepricatedEvent &event) { if (event.getName() == EVENT_UPDATEATTRIBUTE) diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index 5c0b36a38..39d1e689d 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -61,7 +61,7 @@ class MiniStatusWindow final : public Popup, void drawIcons(Graphics *const graphics); - void processEvent(Channels channel, + void processEvent(const Channels channel, const DepricatedEvent &event) override; void updateStatus(); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 3e265ffab..44b9fcd20 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -310,7 +310,7 @@ StatusWindow::StatusWindow() : mLvlLabel->adjustSize(); } -void StatusWindow::processEvent(Channels channel A_UNUSED, +void StatusWindow::processEvent(const Channels channel A_UNUSED, const DepricatedEvent &event) { static bool blocked = false; diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index d7d465d10..eebcd12ca 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -55,7 +55,7 @@ class StatusWindow final : public Window, A_DELETE_COPY(StatusWindow) - void processEvent(Channels channel, + void processEvent(const Channels channel, const DepricatedEvent &event) override; void setPointsNeeded(const int id, const int needed); -- cgit v1.2.3-70-g09d2