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

Update AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp

Avoid checking float against an exact value.

Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
This commit is contained in:
Xilmi 2024-09-05 16:36:07 +02:00 committed by GitHub
parent 20cfe712c9
commit c186de2d52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,7 +87,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const
score *= hero->getArmyCost();
if (hero->type->heroClass->faction == town->getFaction())
score *= 1.5;
if (visitability == 0)
if (vstd::isAlmostZero(visitability))
score *= 30 * town->getTownLevel();
else
score *= town->getTownLevel() / visitability;