1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

New terrain support - part 1 (#755)

Initial support of new terrains
This commit is contained in:
Nordsoft91
2022-06-20 17:39:50 +03:00
committed by Andrii Danylchenko
parent 205bb09880
commit aaa07e4d2e
103 changed files with 1066 additions and 1472 deletions

View File

@@ -16,6 +16,7 @@
#include "CGameState.h"
#include "CTownHandler.h"
#include "CModHandler.h"
#include "Terrain.h"
#include "StringConstants.h"
#include "serializer/JsonDeserializer.h"
#include "serializer/JsonUpdater.h"
@@ -282,13 +283,13 @@ std::string CCreature::nodeName() const
return "\"" + namePl + "\"";
}
bool CCreature::isItNativeTerrain(ETerrainType::EETerrainType terrain) const
bool CCreature::isItNativeTerrain(const Terrain & terrain) const
{
auto native = getNativeTerrain();
return native == terrain || native == ETerrainType::ANY_TERRAIN;
return native == terrain || native == Terrain::ANY;
}
ETerrainType::EETerrainType CCreature::getNativeTerrain() const
Terrain CCreature::getNativeTerrain() const
{
const std::string cachingStringBlocksRetaliation = "type_NO_TERRAIN_PENALTY";
static const auto selectorBlocksRetaliation = Selector::type()(Bonus::NO_TERRAIN_PENALTY);
@@ -296,8 +297,8 @@ ETerrainType::EETerrainType CCreature::getNativeTerrain() const
//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)
? ETerrainType::ANY_TERRAIN
: (ETerrainType::EETerrainType)(*VLC->townh)[faction]->nativeTerrain;
? Terrain::ANY
: (Terrain)(*VLC->townh)[faction]->nativeTerrain;
}
void CCreature::updateFrom(const JsonNode & data)
@@ -1340,11 +1341,6 @@ void CCreatureHandler::removeBonusesFromAllCreatures()
allCreatures.removeBonuses(Selector::all);
}
void CCreatureHandler::restoreAllCreaturesNodeType794()
{
allCreatures.setNodeType(CBonusSystemNode::ENodeTypes::ALL_CREATURES);
}
void CCreatureHandler::buildBonusTreeForTiers()
{
for(CCreature * c : objects)