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:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user