1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Use the same cost value in Pathfinder and fuzzy evaluations.

This commit is contained in:
AlexVinS
2019-01-15 08:52:55 +03:00
parent 4b5910c2f4
commit da20aa2388
14 changed files with 96 additions and 143 deletions

View File

@@ -193,15 +193,14 @@ bool CGHeroInstance::canLearnSkill() const
return secSkills.size() < GameConstants::SKILL_PER_HERO;
}
int CGHeroInstance::maxMovePoints(bool onLand, const TurnInfo * ti) const
int CGHeroInstance::maxMovePoints(bool onLand) const
{
bool localTi = false;
if(!ti)
{
localTi = true;
ti = new TurnInfo(this);
}
TurnInfo ti(this);
return maxMovePointsCached(onLand, &ti);
}
int CGHeroInstance::maxMovePointsCached(bool onLand, const TurnInfo * ti) const
{
int base;
if(onLand)
@@ -225,10 +224,7 @@ int CGHeroInstance::maxMovePoints(bool onLand, const TurnInfo * ti) const
const int subtype = onLand ? SecondarySkill::LOGISTICS : SecondarySkill::NAVIGATION;
const double modifier = ti->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, subtype) / 100.0;
if(localTi)
delete ti;
return int(base* (1+modifier)) + bonus;
return int(base * (1 + modifier)) + bonus;
}
CGHeroInstance::CGHeroInstance()