1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

First version that compiles

This commit is contained in:
Tomasz Zieliński
2022-09-21 11:34:23 +02:00
parent b20f649521
commit 494b0f0226
93 changed files with 431 additions and 359 deletions

View File

@@ -283,22 +283,22 @@ std::string CCreature::nodeName() const
return "\"" + namePl + "\"";
}
bool CCreature::isItNativeTerrain(const Terrain & terrain) const
bool CCreature::isItNativeTerrain(TTerrain terrain) const
{
auto native = getNativeTerrain();
return native == terrain || native == Terrain::ANY;
return native == terrain || native == Terrain::ANY_TERRAIN;
}
Terrain CCreature::getNativeTerrain() const
TTerrain CCreature::getNativeTerrain() const
{
const std::string cachingStringBlocksRetaliation = "type_NO_TERRAIN_PENALTY";
static const auto selectorBlocksRetaliation = Selector::type()(Bonus::NO_TERRAIN_PENALTY);
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY";
static const auto selectorNoTerrainPenalty = 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 hasBonus(selectorBlocksRetaliation, selectorBlocksRetaliation)
? Terrain::ANY
: (Terrain)(*VLC->townh)[faction]->nativeTerrain;
return hasBonus(selectorNoTerrainPenalty, selectorNoTerrainPenalty)
? Terrain::ANY_TERRAIN
: (*VLC->townh)[faction]->nativeTerrain;
}
void CCreature::updateFrom(const JsonNode & data)