|
@@ -977,12 +977,21 @@ void CBonusSystemNode::getAllBonusesRec(BonusList &out) const
|
|
|
|
|
|
for(const auto & b : beforeUpdate)
|
|
|
{
|
|
|
- auto updated = b->updater
|
|
|
- ? getUpdatedBonus(b, b->updater)
|
|
|
+ auto updated = b->updater
|
|
|
+ ? getUpdatedBonus(b, b->updater)
|
|
|
: b;
|
|
|
|
|
|
- //do not add bonus with same pointer
|
|
|
- if(!vstd::contains(out, updated))
|
|
|
+ //do not add bonus with updater
|
|
|
+ bool bonusExists = false;
|
|
|
+ for (auto const & bonus : out )
|
|
|
+ {
|
|
|
+ if (bonus == updated)
|
|
|
+ bonusExists = true;
|
|
|
+ if (bonus->updater && bonus->updater == updated->updater)
|
|
|
+ bonusExists = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bonusExists)
|
|
|
out.push_back(updated);
|
|
|
}
|
|
|
}
|
|
@@ -1971,13 +1980,13 @@ JsonNode ILimiter::toJsonNode() const
|
|
|
|
|
|
int CCreatureTypeLimiter::limit(const BonusLimitationContext &context) const
|
|
|
{
|
|
|
- const CCreature *c = retrieveCreature(&context.node);
|
|
|
- if(!c)
|
|
|
- return true;
|
|
|
- return c->getId() != creature->getId() && (!includeUpgrades || !creature->isMyUpgrade(c));
|
|
|
- //drop bonus if it's not our creature and (we don`t check upgrades or its not our upgrade)
|
|
|
-}
|
|
|
-
|
|
|
+ const CCreature *c = retrieveCreature(&context.node);
|
|
|
+ if(!c)
|
|
|
+ return true;
|
|
|
+ return c->getId() != creature->getId() && (!includeUpgrades || !creature->isMyUpgrade(c));
|
|
|
+ //drop bonus if it's not our creature and (we don`t check upgrades or its not our upgrade)
|
|
|
+}
|
|
|
+
|
|
|
CCreatureTypeLimiter::CCreatureTypeLimiter(const CCreature & creature_, bool IncludeUpgrades)
|
|
|
: creature(&creature_), includeUpgrades(IncludeUpgrades)
|
|
|
{
|