mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge pull request #1835 from rilian-la-te/fix-native-type
CCreatureHandler: fix native terrain for any
This commit is contained in:
commit
a3074e2741
@ -327,12 +327,12 @@ bool CCreature::isItNativeTerrain(TerrainId terrain) const
|
||||
|
||||
TerrainId CCreature::getNativeTerrain() const
|
||||
{
|
||||
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY";
|
||||
static const auto selectorNoTerrainPenalty = Selector::type()(Bonus::NO_TERRAIN_PENALTY);
|
||||
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY_sANY";
|
||||
static const auto selectorNoTerrainPenalty = Selector::typeSubtype(Bonus::NO_TERRAIN_PENALTY, static_cast<int>(ETerrainId::ANY_TERRAIN));
|
||||
|
||||
//this code is used in the CreatureTerrainLimiter::limit to setup battle bonuses
|
||||
//and in the CGHeroInstance::getNativeTerrain() to setup movement bonuses or/and penalties.
|
||||
return hasBonus(selectorNoTerrainPenalty, selectorNoTerrainPenalty)
|
||||
return hasBonus(selectorNoTerrainPenalty, cachingStringNoTerrainPenalty)
|
||||
? TerrainId(ETerrainId::ANY_TERRAIN)
|
||||
: (*VLC->townh)[faction]->nativeTerrain;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user