mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
Remove ConstTransitivePtr from hero and town instances
This commit is contained in:
@ -47,16 +47,16 @@ ui64 FuzzyHelper::evaluateDanger(const int3 & tile, const CGHeroInstance * visit
|
||||
{
|
||||
auto hero = dynamic_cast<const CGHeroInstance *>(dangerousObject);
|
||||
|
||||
if(hero->visitedTown && !hero->visitedTown->garrisonHero)
|
||||
if(hero->getVisitedTown() && !hero->getVisitedTown()->getGarrisonHero())
|
||||
{
|
||||
objectDanger += evaluateDanger(hero->visitedTown.get());
|
||||
objectDanger += evaluateDanger(hero->getVisitedTown());
|
||||
}
|
||||
objectDanger *= ai->heroManager->getFightingStrengthCached(hero);
|
||||
}
|
||||
if (objWithID<Obj::TOWN>(dangerousObject))
|
||||
{
|
||||
auto town = dynamic_cast<const CGTownInstance*>(dangerousObject);
|
||||
auto hero = town->garrisonHero;
|
||||
auto hero = town->getGarrisonHero();
|
||||
|
||||
if (hero)
|
||||
objectDanger *= ai->heroManager->getFightingStrengthCached(hero);
|
||||
@ -121,7 +121,7 @@ ui64 FuzzyHelper::evaluateDanger(const CGObjectInstance * obj)
|
||||
const CGTownInstance * town = dynamic_cast<const CGTownInstance *>(obj);
|
||||
auto danger = town->getUpperArmy()->getArmyStrength();
|
||||
|
||||
if(danger || town->visitingHero)
|
||||
if(danger || town->getVisitingHero())
|
||||
{
|
||||
auto fortLevel = town->fortLevel();
|
||||
|
||||
|
Reference in New Issue
Block a user