浏览代码

Remove unused method

Ivan Savenko 1 年之前
父节点
当前提交
072aa8aadd
共有 2 个文件被更改,包括 5 次插入16 次删除
  1. 4 13
      lib/mapObjects/CRewardableObject.cpp
  2. 1 3
      lib/mapObjects/CRewardableObject.h

+ 4 - 13
lib/mapObjects/CRewardableObject.cpp

@@ -95,16 +95,7 @@ std::vector<Component> 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<Component> CRewardableObject::getPopupComponentsImpl(PlayerColor pla
 	if (!wasScouted(player))
 		return {};
 
-	if (guardedPresently())
+	if (isGuarded())
 	{
 		if (!cb->getSettings().getBoolean(EGameSettings::BANKS_SHOW_GUARDS_COMPOSITION))
 			return {};

+ 1 - 3
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)