1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00

Fix BonusLimitEffect #3070

Change BonusList::getBonus() to return bonuses with any BonusLimitEffect by default (returned only bonuses with BonusLimitEffect::NO_LIMIT previously)
This commit is contained in:
Kris-Ja 2024-03-25 23:17:23 +01:00
parent 83984a73c7
commit 27ba4f10be
2 changed files with 2 additions and 4 deletions

View File

@ -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;

View File

@ -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);
}
}