1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Reduced number of accesses to CGObjectInstance::subID

This commit is contained in:
Ivan Savenko
2023-10-24 17:11:25 +03:00
parent 455d8d4738
commit 03e1169781
27 changed files with 135 additions and 97 deletions

View File

@ -250,10 +250,10 @@ void CMap::calculateGuardingGreaturePositions()
}
}
CGHeroInstance * CMap::getHero(int heroID)
CGHeroInstance * CMap::getHero(HeroTypeID heroID)
{
for(auto & elem : heroesOnMap)
if(elem->subID == heroID)
if(elem->getObjTypeIndex() == heroID.getNum())
return elem;
return nullptr;
}