From 072aa8aadd2e8987052727996a76b1d67b6f33dc Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Fri, 27 Sep 2024 13:25:18 +0000 Subject: [PATCH] Remove unused method --- lib/mapObjects/CRewardableObject.cpp | 17 ++++------------- lib/mapObjects/CRewardableObject.h | 4 +--- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/lib/mapObjects/CRewardableObject.cpp b/lib/mapObjects/CRewardableObject.cpp index 90c02aacb..5f6d06739 100644 --- a/lib/mapObjects/CRewardableObject.cpp +++ b/lib/mapObjects/CRewardableObject.cpp @@ -95,16 +95,7 @@ std::vector CRewardableObject::loadComponents(const CGHeroInstance * return result; } -bool CRewardableObject::guardedPotentially() const -{ - for (auto const & visitInfo : configuration.info) - if (!visitInfo.reward.guards.empty()) - return true; - - return false; -} - -bool CRewardableObject::guardedPresently() const +bool CRewardableObject::isGuarded() const { return stacksCount() > 0; } @@ -117,7 +108,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *hero) const cb->sendAndApply(&cov); } - if (guardedPresently()) + if (isGuarded()) { auto guardedIndexes = getAvailableRewards(hero, Rewardable::EEventType::EVENT_GUARDED); auto guardedReward = configuration.info.at(guardedIndexes.at(0)); @@ -236,7 +227,7 @@ void CRewardableObject::battleFinished(const CGHeroInstance *hero, const BattleR void CRewardableObject::blockingDialogAnswered(const CGHeroInstance * hero, int32_t answer) const { - if(guardedPresently()) + if(isGuarded()) { if (answer) { @@ -410,7 +401,7 @@ std::vector CRewardableObject::getPopupComponentsImpl(PlayerColor pla if (!wasScouted(player)) return {}; - if (guardedPresently()) + if (isGuarded()) { if (!cb->getSettings().getBoolean(EGameSettings::BANKS_SHOW_GUARDS_COMPOSITION)) return {}; diff --git a/lib/mapObjects/CRewardableObject.h b/lib/mapObjects/CRewardableObject.h index 39a658ad2..4619e38c2 100644 --- a/lib/mapObjects/CRewardableObject.h +++ b/lib/mapObjects/CRewardableObject.h @@ -47,10 +47,8 @@ protected: void doHeroVisit(const CGHeroInstance *h) const; - /// Returns true if this object might have guards present, whether they were cleared or not - bool guardedPotentially() const; /// Returns true if this object is currently guarded - bool guardedPresently() const; + bool isGuarded() const; public: /// Visitability checks. Note that hero check includes check for hero owner (returns true if object was visited by player)