|
@@ -76,7 +76,8 @@ const std::map<std::string, TLimiterPtr> bonusLimiterMap =
|
|
{"IS_UNDEAD", std::make_shared<HasAnotherBonusLimiter>(Bonus::UNDEAD)},
|
|
{"IS_UNDEAD", std::make_shared<HasAnotherBonusLimiter>(Bonus::UNDEAD)},
|
|
{"CREATURE_NATIVE_TERRAIN", std::make_shared<CreatureTerrainLimiter>()},
|
|
{"CREATURE_NATIVE_TERRAIN", std::make_shared<CreatureTerrainLimiter>()},
|
|
{"CREATURE_FACTION", std::make_shared<CreatureFactionLimiter>()},
|
|
{"CREATURE_FACTION", std::make_shared<CreatureFactionLimiter>()},
|
|
- {"OPPOSITE_SIDE", std::make_shared<OppositeSideLimiter>()}
|
|
|
|
|
|
+ {"OPPOSITE_SIDE", std::make_shared<OppositeSideLimiter>()},
|
|
|
|
+ {"UNIT_ON_HEXES", std::make_shared<UnitOnHexLimiter>()}
|
|
};
|
|
};
|
|
|
|
|
|
const std::map<std::string, TPropagatorPtr> bonusPropagatorMap =
|
|
const std::map<std::string, TPropagatorPtr> bonusPropagatorMap =
|
|
@@ -369,8 +370,8 @@ JsonNode CAddInfo::toJsonNode() const
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-std::atomic<int32_t> CBonusSystemNode::treeChanged(1);
|
|
|
|
-const bool CBonusSystemNode::cachingEnabled = true;
|
|
|
|
|
|
+std::atomic<int64_t> CBonusSystemNode::treeChanged(1);
|
|
|
|
+constexpr bool CBonusSystemNode::cachingEnabled = true;
|
|
|
|
|
|
BonusList::BonusList(bool BelongsToTree) : belongsToTree(BelongsToTree)
|
|
BonusList::BonusList(bool BelongsToTree) : belongsToTree(BelongsToTree)
|
|
{
|
|
{
|
|
@@ -1499,20 +1500,20 @@ void CBonusSystemNode::limitBonuses(const BonusList &allBonuses, BonusList &out)
|
|
{
|
|
{
|
|
auto b = undecided[i];
|
|
auto b = undecided[i];
|
|
BonusLimitationContext context = {b, *this, out, undecided};
|
|
BonusLimitationContext context = {b, *this, out, undecided};
|
|
- int decision = b->limiter ? b->limiter->limit(context) : ILimiter::ACCEPT; //bonuses without limiters will be accepted by default
|
|
|
|
- if(decision == ILimiter::DISCARD)
|
|
|
|
|
|
+ auto decision = b->limiter ? b->limiter->limit(context) : ILimiter::EDecision::ACCEPT; //bonuses without limiters will be accepted by default
|
|
|
|
+ if(decision == ILimiter::EDecision::DISCARD)
|
|
{
|
|
{
|
|
undecided.erase(i);
|
|
undecided.erase(i);
|
|
i--; continue;
|
|
i--; continue;
|
|
}
|
|
}
|
|
- else if(decision == ILimiter::ACCEPT)
|
|
|
|
|
|
+ else if(decision == ILimiter::EDecision::ACCEPT)
|
|
{
|
|
{
|
|
accepted.push_back(b);
|
|
accepted.push_back(b);
|
|
undecided.erase(i);
|
|
undecided.erase(i);
|
|
i--; continue;
|
|
i--; continue;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- assert(decision == ILimiter::NOT_SURE);
|
|
|
|
|
|
+ assert(decision == ILimiter::EDecision::NOT_SURE);
|
|
}
|
|
}
|
|
|
|
|
|
if(undecided.size() == undecidedCount) //we haven't moved a single bonus -> limiters reached a stable state
|
|
if(undecided.size() == undecidedCount) //we haven't moved a single bonus -> limiters reached a stable state
|
|
@@ -1534,22 +1535,7 @@ void CBonusSystemNode::treeHasChanged()
|
|
|
|
|
|
int64_t CBonusSystemNode::getTreeVersion() const
|
|
int64_t CBonusSystemNode::getTreeVersion() const
|
|
{
|
|
{
|
|
- int64_t ret = treeChanged;
|
|
|
|
- return ret << 32;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-int NBonus::valOf(const CBonusSystemNode *obj, Bonus::BonusType type, int subtype)
|
|
|
|
-{
|
|
|
|
- if(obj)
|
|
|
|
- return obj->valOfBonuses(type, subtype);
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-bool NBonus::hasOfType(const CBonusSystemNode *obj, Bonus::BonusType type, int subtype)
|
|
|
|
-{
|
|
|
|
- if(obj)
|
|
|
|
- return obj->hasBonusOfType(type, subtype);
|
|
|
|
- return false;
|
|
|
|
|
|
+ return treeChanged;
|
|
}
|
|
}
|
|
|
|
|
|
std::string Bonus::Description(boost::optional<si32> customValue) const
|
|
std::string Bonus::Description(boost::optional<si32> customValue) const
|
|
@@ -2070,21 +2056,6 @@ namespace Selector
|
|
|
|
|
|
DLL_LINKAGE CSelector all([](const Bonus * b){return true;});
|
|
DLL_LINKAGE CSelector all([](const Bonus * b){return true;});
|
|
DLL_LINKAGE CSelector none([](const Bonus * b){return false;});
|
|
DLL_LINKAGE CSelector none([](const Bonus * b){return false;});
|
|
-
|
|
|
|
- bool DLL_LINKAGE matchesType(const CSelector &sel, Bonus::BonusType type)
|
|
|
|
- {
|
|
|
|
- Bonus dummy;
|
|
|
|
- dummy.type = type;
|
|
|
|
- return sel(&dummy);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- bool DLL_LINKAGE matchesTypeSubtype(const CSelector &sel, Bonus::BonusType type, TBonusSubtype subtype)
|
|
|
|
- {
|
|
|
|
- Bonus dummy;
|
|
|
|
- dummy.type = type;
|
|
|
|
- dummy.subtype = subtype;
|
|
|
|
- return sel(&dummy);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
const CCreature * retrieveCreature(const CBonusSystemNode *node)
|
|
const CCreature * retrieveCreature(const CBonusSystemNode *node)
|
|
@@ -2165,9 +2136,9 @@ std::shared_ptr<Bonus> Bonus::addLimiter(const TLimiterPtr & Limiter)
|
|
return this->shared_from_this();
|
|
return this->shared_from_this();
|
|
}
|
|
}
|
|
|
|
|
|
-int ILimiter::limit(const BonusLimitationContext &context) const /*return true to drop the bonus */
|
|
|
|
|
|
+ILimiter::EDecision ILimiter::limit(const BonusLimitationContext &context) const /*return true to drop the bonus */
|
|
{
|
|
{
|
|
- return false;
|
|
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
}
|
|
}
|
|
|
|
|
|
std::string ILimiter::toString() const
|
|
std::string ILimiter::toString() const
|
|
@@ -2182,12 +2153,14 @@ JsonNode ILimiter::toJsonNode() const
|
|
return root;
|
|
return root;
|
|
}
|
|
}
|
|
|
|
|
|
-int CCreatureTypeLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
|
|
+ILimiter::EDecision CCreatureTypeLimiter::limit(const BonusLimitationContext &context) const
|
|
{
|
|
{
|
|
const CCreature *c = retrieveCreature(&context.node);
|
|
const CCreature *c = retrieveCreature(&context.node);
|
|
if(!c)
|
|
if(!c)
|
|
- return true;
|
|
|
|
- return c->getId() != creature->getId() && (!includeUpgrades || !creature->isMyUpgrade(c));
|
|
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
|
|
+
|
|
|
|
+ auto accept = c->getId() == creature->getId() || (includeUpgrades && creature->isMyUpgrade(c));
|
|
|
|
+ return accept ? ILimiter::EDecision::ACCEPT : ILimiter::EDecision::DISCARD;
|
|
//drop bonus if it's not our creature and (we don`t check upgrades or its not our upgrade)
|
|
//drop bonus if it's not our creature and (we don`t check upgrades or its not our upgrade)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2239,7 +2212,7 @@ HasAnotherBonusLimiter::HasAnotherBonusLimiter(Bonus::BonusType bonus, TBonusSub
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
-int HasAnotherBonusLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
|
|
+ILimiter::EDecision HasAnotherBonusLimiter::limit(const BonusLimitationContext &context) const
|
|
{
|
|
{
|
|
//TODO: proper selector config with parsing of JSON
|
|
//TODO: proper selector config with parsing of JSON
|
|
auto mySelector = Selector::type()(type);
|
|
auto mySelector = Selector::type()(type);
|
|
@@ -2253,14 +2226,14 @@ int HasAnotherBonusLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
|
|
//if we have a bonus of required type accepted, limiter should accept also this bonus
|
|
//if we have a bonus of required type accepted, limiter should accept also this bonus
|
|
if(context.alreadyAccepted.getFirst(mySelector))
|
|
if(context.alreadyAccepted.getFirst(mySelector))
|
|
- return ACCEPT;
|
|
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
|
|
|
|
//if there are no matching bonuses pending, we can (and must) reject right away
|
|
//if there are no matching bonuses pending, we can (and must) reject right away
|
|
if(!context.stillUndecided.getFirst(mySelector))
|
|
if(!context.stillUndecided.getFirst(mySelector))
|
|
- return DISCARD;
|
|
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
|
|
|
|
//do not accept for now but it may change if more bonuses gets included
|
|
//do not accept for now but it may change if more bonuses gets included
|
|
- return NOT_SURE;
|
|
|
|
|
|
+ return ILimiter::EDecision::NOT_SURE;
|
|
}
|
|
}
|
|
|
|
|
|
std::string HasAnotherBonusLimiter::toString() const
|
|
std::string HasAnotherBonusLimiter::toString() const
|
|
@@ -2296,6 +2269,35 @@ JsonNode HasAnotherBonusLimiter::toJsonNode() const
|
|
return root;
|
|
return root;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ILimiter::EDecision UnitOnHexLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
+{
|
|
|
|
+ const auto * stack = retrieveStackBattle(&context.node);
|
|
|
|
+ if(!stack)
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
|
|
+
|
|
|
|
+ auto accept = false;
|
|
|
|
+ for (const auto & hex : stack->getHexes())
|
|
|
|
+ accept |= !!applicableHexes.count(hex);
|
|
|
|
+
|
|
|
|
+ return accept ? ILimiter::EDecision::ACCEPT : ILimiter::EDecision::DISCARD;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+UnitOnHexLimiter::UnitOnHexLimiter(const std::set<BattleHex> & applicableHexes):
|
|
|
|
+ applicableHexes(applicableHexes)
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+JsonNode UnitOnHexLimiter::toJsonNode() const
|
|
|
|
+{
|
|
|
|
+ JsonNode root(JsonNode::JsonType::DATA_STRUCT);
|
|
|
|
+
|
|
|
|
+ root["type"].String() = "UNIT_ON_HEXES";
|
|
|
|
+ for(const auto & hex : applicableHexes)
|
|
|
|
+ root["parameters"].Vector().push_back(JsonUtils::intNode(hex));
|
|
|
|
+
|
|
|
|
+ return root;
|
|
|
|
+}
|
|
|
|
+
|
|
bool IPropagator::shouldBeAttached(CBonusSystemNode *dest)
|
|
bool IPropagator::shouldBeAttached(CBonusSystemNode *dest)
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
@@ -2337,21 +2339,19 @@ CreatureTerrainLimiter::CreatureTerrainLimiter(TerrainId terrain):
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
-int CreatureTerrainLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
|
|
+ILimiter::EDecision CreatureTerrainLimiter::limit(const BonusLimitationContext &context) const
|
|
{
|
|
{
|
|
const CStack *stack = retrieveStackBattle(&context.node);
|
|
const CStack *stack = retrieveStackBattle(&context.node);
|
|
if(stack)
|
|
if(stack)
|
|
{
|
|
{
|
|
- if (terrainType == ETerrainId::NATIVE_TERRAIN)//terrainType not specified = native
|
|
|
|
- {
|
|
|
|
- return !stack->isOnNativeTerrain();
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- return !stack->isOnTerrain(terrainType);
|
|
|
|
- }
|
|
|
|
|
|
+ if (terrainType == ETerrainId::NATIVE_TERRAIN && stack->isOnNativeTerrain())//terrainType not specified = native
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
|
|
+
|
|
|
|
+ if(terrainType != ETerrainId::NATIVE_TERRAIN && stack->isOnTerrain(terrainType))
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
|
|
+
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
//TODO neutral creatues
|
|
//TODO neutral creatues
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2384,10 +2384,11 @@ CreatureFactionLimiter::CreatureFactionLimiter():
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
-int CreatureFactionLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
|
|
+ILimiter::EDecision CreatureFactionLimiter::limit(const BonusLimitationContext &context) const
|
|
{
|
|
{
|
|
const CCreature *c = retrieveCreature(&context.node);
|
|
const CCreature *c = retrieveCreature(&context.node);
|
|
- return !c || c->faction != faction; //drop bonus for non-creatures or non-native residents
|
|
|
|
|
|
+ auto accept = c && c->faction == faction;
|
|
|
|
+ return accept ? ILimiter::EDecision::ACCEPT : ILimiter::EDecision::DISCARD; //drop bonus for non-creatures or non-native residents
|
|
}
|
|
}
|
|
|
|
|
|
std::string CreatureFactionLimiter::toString() const
|
|
std::string CreatureFactionLimiter::toString() const
|
|
@@ -2417,23 +2418,19 @@ CreatureAlignmentLimiter::CreatureAlignmentLimiter(si8 Alignment)
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
-int CreatureAlignmentLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
|
|
+ILimiter::EDecision CreatureAlignmentLimiter::limit(const BonusLimitationContext &context) const
|
|
{
|
|
{
|
|
- const CCreature *c = retrieveCreature(&context.node);
|
|
|
|
- if(!c)
|
|
|
|
- return true;
|
|
|
|
- switch(alignment)
|
|
|
|
- {
|
|
|
|
- case EAlignment::GOOD:
|
|
|
|
- return !c->isGood(); //if not good -> return true (drop bonus)
|
|
|
|
- case EAlignment::NEUTRAL:
|
|
|
|
- return c->isEvil() || c->isGood();
|
|
|
|
- case EAlignment::EVIL:
|
|
|
|
- return !c->isEvil();
|
|
|
|
- default:
|
|
|
|
- logBonus->warn("Warning: illegal alignment in limiter!");
|
|
|
|
- return true;
|
|
|
|
|
|
+ const auto * c = retrieveCreature(&context.node);
|
|
|
|
+ if(c) {
|
|
|
|
+ if(alignment == EAlignment::GOOD && c->isGood())
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
|
|
+ if(alignment == EAlignment::EVIL && c->isEvil())
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
|
|
+ if(alignment == EAlignment::NEUTRAL && !c->isEvil() && !c->isGood())
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
}
|
|
}
|
|
|
|
|
|
std::string CreatureAlignmentLimiter::toString() const
|
|
std::string CreatureAlignmentLimiter::toString() const
|
|
@@ -2463,28 +2460,29 @@ RankRangeLimiter::RankRangeLimiter()
|
|
minRank = maxRank = -1;
|
|
minRank = maxRank = -1;
|
|
}
|
|
}
|
|
|
|
|
|
-int RankRangeLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
|
|
+ILimiter::EDecision RankRangeLimiter::limit(const BonusLimitationContext &context) const
|
|
{
|
|
{
|
|
const CStackInstance * csi = retrieveStackInstance(&context.node);
|
|
const CStackInstance * csi = retrieveStackInstance(&context.node);
|
|
if(csi)
|
|
if(csi)
|
|
{
|
|
{
|
|
if (csi->getNodeType() == CBonusSystemNode::COMMANDER) //no stack exp bonuses for commander creatures
|
|
if (csi->getNodeType() == CBonusSystemNode::COMMANDER) //no stack exp bonuses for commander creatures
|
|
- return true;
|
|
|
|
- return csi->getExpRank() < minRank || csi->getExpRank() > maxRank;
|
|
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
|
|
+ if (csi->getExpRank() > minRank && csi->getExpRank() < maxRank)
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
}
|
|
}
|
|
|
|
|
|
-int StackOwnerLimiter::limit(const BonusLimitationContext &context) const
|
|
|
|
|
|
+ILimiter::EDecision StackOwnerLimiter::limit(const BonusLimitationContext &context) const
|
|
{
|
|
{
|
|
const CStack * s = retrieveStackBattle(&context.node);
|
|
const CStack * s = retrieveStackBattle(&context.node);
|
|
- if(s)
|
|
|
|
- return s->owner != owner;
|
|
|
|
|
|
+ if(s && s->owner == owner)
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
|
|
|
|
const CStackInstance * csi = retrieveStackInstance(&context.node);
|
|
const CStackInstance * csi = retrieveStackInstance(&context.node);
|
|
- if(csi && csi->armyObj)
|
|
|
|
- return csi->armyObj->tempOwner != owner;
|
|
|
|
- return true;
|
|
|
|
|
|
+ if(csi && csi->armyObj && csi->armyObj->tempOwner == owner)
|
|
|
|
+ return ILimiter::EDecision::ACCEPT;
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
}
|
|
}
|
|
|
|
|
|
StackOwnerLimiter::StackOwnerLimiter()
|
|
StackOwnerLimiter::StackOwnerLimiter()
|
|
@@ -2507,10 +2505,10 @@ OppositeSideLimiter::OppositeSideLimiter(const PlayerColor & Owner):
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
-int OppositeSideLimiter::limit(const BonusLimitationContext & context) const
|
|
|
|
|
|
+ILimiter::EDecision OppositeSideLimiter::limit(const BonusLimitationContext & context) const
|
|
{
|
|
{
|
|
auto contextOwner = CBonusSystemNode::retrieveNodeOwner(& context.node);
|
|
auto contextOwner = CBonusSystemNode::retrieveNodeOwner(& context.node);
|
|
- auto decision = (owner == contextOwner || owner == PlayerColor::CANNOT_DETERMINE) ? ILimiter::DISCARD : ILimiter::ACCEPT;
|
|
|
|
|
|
+ auto decision = (owner == contextOwner || owner == PlayerColor::CANNOT_DETERMINE) ? ILimiter::EDecision::DISCARD : ILimiter::EDecision::ACCEPT;
|
|
return decision;
|
|
return decision;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2537,20 +2535,20 @@ const std::string & AllOfLimiter::getAggregator() const
|
|
return aggregator;
|
|
return aggregator;
|
|
}
|
|
}
|
|
|
|
|
|
-int AllOfLimiter::limit(const BonusLimitationContext & context) const
|
|
|
|
|
|
+ILimiter::EDecision AllOfLimiter::limit(const BonusLimitationContext & context) const
|
|
{
|
|
{
|
|
bool wasntSure = false;
|
|
bool wasntSure = false;
|
|
|
|
|
|
for(const auto & limiter : limiters)
|
|
for(const auto & limiter : limiters)
|
|
{
|
|
{
|
|
auto result = limiter->limit(context);
|
|
auto result = limiter->limit(context);
|
|
- if(result == ILimiter::DISCARD)
|
|
|
|
|
|
+ if(result == ILimiter::EDecision::DISCARD)
|
|
return result;
|
|
return result;
|
|
- if(result == ILimiter::NOT_SURE)
|
|
|
|
|
|
+ if(result == ILimiter::EDecision::NOT_SURE)
|
|
wasntSure = true;
|
|
wasntSure = true;
|
|
}
|
|
}
|
|
|
|
|
|
- return wasntSure ? ILimiter::NOT_SURE : ILimiter::ACCEPT;
|
|
|
|
|
|
+ return wasntSure ? ILimiter::EDecision::NOT_SURE : ILimiter::EDecision::ACCEPT;
|
|
}
|
|
}
|
|
|
|
|
|
const std::string AnyOfLimiter::aggregator = "anyOf";
|
|
const std::string AnyOfLimiter::aggregator = "anyOf";
|
|
@@ -2559,20 +2557,20 @@ const std::string & AnyOfLimiter::getAggregator() const
|
|
return aggregator;
|
|
return aggregator;
|
|
}
|
|
}
|
|
|
|
|
|
-int AnyOfLimiter::limit(const BonusLimitationContext & context) const
|
|
|
|
|
|
+ILimiter::EDecision AnyOfLimiter::limit(const BonusLimitationContext & context) const
|
|
{
|
|
{
|
|
bool wasntSure = false;
|
|
bool wasntSure = false;
|
|
|
|
|
|
for(const auto & limiter : limiters)
|
|
for(const auto & limiter : limiters)
|
|
{
|
|
{
|
|
auto result = limiter->limit(context);
|
|
auto result = limiter->limit(context);
|
|
- if(result == ILimiter::ACCEPT)
|
|
|
|
|
|
+ if(result == ILimiter::EDecision::ACCEPT)
|
|
return result;
|
|
return result;
|
|
- if(result == ILimiter::NOT_SURE)
|
|
|
|
|
|
+ if(result == ILimiter::EDecision::NOT_SURE)
|
|
wasntSure = true;
|
|
wasntSure = true;
|
|
}
|
|
}
|
|
|
|
|
|
- return wasntSure ? ILimiter::NOT_SURE : ILimiter::DISCARD;
|
|
|
|
|
|
+ return wasntSure ? ILimiter::EDecision::NOT_SURE : ILimiter::EDecision::DISCARD;
|
|
}
|
|
}
|
|
|
|
|
|
const std::string NoneOfLimiter::aggregator = "noneOf";
|
|
const std::string NoneOfLimiter::aggregator = "noneOf";
|
|
@@ -2581,20 +2579,20 @@ const std::string & NoneOfLimiter::getAggregator() const
|
|
return aggregator;
|
|
return aggregator;
|
|
}
|
|
}
|
|
|
|
|
|
-int NoneOfLimiter::limit(const BonusLimitationContext & context) const
|
|
|
|
|
|
+ILimiter::EDecision NoneOfLimiter::limit(const BonusLimitationContext & context) const
|
|
{
|
|
{
|
|
bool wasntSure = false;
|
|
bool wasntSure = false;
|
|
|
|
|
|
for(const auto & limiter : limiters)
|
|
for(const auto & limiter : limiters)
|
|
{
|
|
{
|
|
auto result = limiter->limit(context);
|
|
auto result = limiter->limit(context);
|
|
- if(result == ILimiter::ACCEPT)
|
|
|
|
- return ILimiter::DISCARD;
|
|
|
|
- if(result == ILimiter::NOT_SURE)
|
|
|
|
|
|
+ if(result == ILimiter::EDecision::ACCEPT)
|
|
|
|
+ return ILimiter::EDecision::DISCARD;
|
|
|
|
+ if(result == ILimiter::EDecision::NOT_SURE)
|
|
wasntSure = true;
|
|
wasntSure = true;
|
|
}
|
|
}
|
|
|
|
|
|
- return wasntSure ? ILimiter::NOT_SURE : ILimiter::ACCEPT;
|
|
|
|
|
|
+ return wasntSure ? ILimiter::EDecision::NOT_SURE : ILimiter::EDecision::ACCEPT;
|
|
}
|
|
}
|
|
|
|
|
|
// Updaters
|
|
// Updaters
|