mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Fix performance issue related to TurnInfo construction
This commit is contained in:
committed by
Andrii Danylchenko
parent
b061c4988c
commit
31c9d6e28d
@@ -290,10 +290,13 @@ bool CCreature::isItNativeTerrain(ETerrainType::EETerrainType terrain) const
|
||||
|
||||
ETerrainType::EETerrainType CCreature::getNativeTerrain() const
|
||||
{
|
||||
const std::string cachingStringBlocksRetaliation = "type_NO_TERRAIN_PENALTY";
|
||||
static const auto selectorBlocksRetaliation = Selector::type()(Bonus::NO_TERRAIN_PENALTY);
|
||||
|
||||
//this code is used in the CreatureTerrainLimiter::limit to setup battle bonuses
|
||||
//and in the CGHeroInstance::getNativeTerrain() to setup mevement bonuses or/and penalties.
|
||||
return hasBonusOfType(Bonus::NO_TERRAIN_PENALTY) ?
|
||||
ETerrainType::ANY_TERRAIN
|
||||
return hasBonus(selectorBlocksRetaliation, selectorBlocksRetaliation)
|
||||
? ETerrainType::ANY_TERRAIN
|
||||
: (ETerrainType::EETerrainType)(*VLC->townh)[faction]->nativeTerrain;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user