浏览代码

Fix BonusLimitEffect #3070

Change BonusList::getBonus() to return bonuses with any BonusLimitEffect by default (returned only bonuses with BonusLimitEffect::NO_LIMIT previously)
Kris-Ja 1 年之前
父节点
当前提交
27ba4f10be
共有 2 个文件被更改,包括 2 次插入4 次删除
  1. 1 1
      lib/bonuses/Bonus.h
  2. 1 3
      lib/bonuses/BonusList.cpp

+ 1 - 1
lib/bonuses/Bonus.h

@@ -70,7 +70,7 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>
 	std::string stacking; // bonuses with the same stacking value don't stack (e.g. Angel/Archangel morale bonus)
 
 	CAddInfo additionalInfo;
-	BonusLimitEffect effectRange = BonusLimitEffect::NO_LIMIT; //if not NO_LIMIT, bonus will be omitted by default
+	BonusLimitEffect effectRange = BonusLimitEffect::NO_LIMIT;
 
 	TLimiterPtr limiter;
 	TPropagatorPtr propagator;

+ 1 - 3
lib/bonuses/BonusList.cpp

@@ -190,9 +190,7 @@ void BonusList::getBonuses(BonusList & out, const CSelector &selector, const CSe
 	out.reserve(bonuses.size());
 	for(const auto & b : bonuses)
 	{
-		//add matching bonuses that matches limit predicate or have NO_LIMIT if no given predicate
-		auto noFightLimit = b->effectRange == BonusLimitEffect::NO_LIMIT;
-		if(selector(b.get()) && ((!limit && noFightLimit) || ((bool)limit && limit(b.get()))))
+		if(selector(b.get()) && (!limit || ((bool)limit && limit(b.get()))))
 			out.push_back(b);
 	}
 }