1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

added support for new specialty json format; old format is converted to bonuses with updaters

This commit is contained in:
Henning Koehler
2017-09-10 14:10:50 +12:00
parent f867b1a37e
commit 3e0022be27
7 changed files with 234 additions and 274 deletions

View File

@@ -827,6 +827,8 @@ void CBonusSystemNode::addNewBonus(const std::shared_ptr<Bonus>& b)
assert(!vstd::contains(exportedBonuses, b));
exportedBonuses.push_back(b);
exportBonus(b);
if(b->updater)
b->updater->update(*b, *this);
CBonusSystemNode::treeHasChanged();
}
@@ -1563,7 +1565,11 @@ void LimiterList::add( TLimiterPtr limiter )
limiters.push_back(limiter);
}
bool ScalingUpdater::update(Bonus & b, const CBonusSystemNode & context)
ScalingUpdater::ScalingUpdater(int valPer20, int stepSize) : valPer20(valPer20), stepSize(stepSize)
{
}
bool ScalingUpdater::update(Bonus & b, const CBonusSystemNode & context) const
{
if(context.getNodeType() == CBonusSystemNode::HERO)
{