1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Bonus system: add treeHasChanged call where bonus objects changed

This commit is contained in:
ArseniyShestakov 2015-12-11 16:13:18 +03:00
parent 1730a31471
commit 59199ccdbd
5 changed files with 8 additions and 0 deletions

View File

@ -694,6 +694,7 @@ void CArtHandler::afterLoadFinalization()
bonus->sid = art->id;
}
}
CBonusSystemNode::treeHasChanged();
for (CArtifact * art : artifacts)
{

View File

@ -140,6 +140,7 @@ void CCreature::setId(CreatureID ID)
if(bonus->source == Bonus::CREATURE_ABILITY)
bonus->sid = ID;
}
CBonusSystemNode::treeHasChanged();
}
static void AddAbility(CCreature *cre, const JsonVector &ability_vec)

View File

@ -96,6 +96,7 @@ void CArmedInstance::updateMoraleBonusFromArmy()
b->description = b->description.substr(0, b->description.size()-2);//trim value
}
boost::algorithm::trim(b->description);
CBonusSystemNode::treeHasChanged();
//-1 modifier for any Undead unit in army
const ui8 UNDEAD_MODIFIER_ID = -2;

View File

@ -831,6 +831,7 @@ void CGHeroInstance::updateSkill(SecondarySkill which, int val)
addNewBonus(bonus);
}
CBonusSystemNode::treeHasChanged();
}
void CGHeroInstance::setPropertyDer( ui8 what, ui32 val )
{
@ -1365,6 +1366,7 @@ void CGHeroInstance::setPrimarySkill(PrimarySkill::PrimarySkill primarySkill, si
{
skill->val += value;
}
CBonusSystemNode::treeHasChanged();
}
else if(primarySkill == PrimarySkill::EXPERIENCE)
{

View File

@ -864,7 +864,10 @@ void CGTownInstance::updateMoraleBonusFromArmy()
}
if (garrisonHero)
{
b->val = 0;
CBonusSystemNode::treeHasChanged();
}
else
CArmedInstance::updateMoraleBonusFromArmy();
}