1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

Remove T prefix from new typedefs

This commit is contained in:
Tomasz Zieliński 2022-09-29 11:44:46 +02:00
parent 475f835769
commit 20c102e648
65 changed files with 145 additions and 145 deletions

View File

@ -84,7 +84,7 @@ public:
// Sets
std::vector<soundBase::soundID> pickupSounds;
std::vector<soundBase::soundID> battleIntroSounds;
std::map<TTerrainId, soundBase::soundID> horseSounds;
std::map<TerrainId, soundBase::soundID> horseSounds;
};
// Helper //now it looks somewhat useless

View File

@ -2746,8 +2746,8 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
{
path.convert(0);
TTerrainId currentTerrain = Terrain::BORDER; // not init yet
TTerrainId newTerrain;
TerrainId currentTerrain = Terrain::BORDER; // not init yet
TerrainId newTerrain;
int sh = -1;
auto canStop = [&](CGPathNode * node) -> bool

View File

@ -495,9 +495,9 @@ void CMinimapInstance::showAll(SDL_Surface * to)
}
}
std::map<TTerrainId, std::pair<SDL_Color, SDL_Color> > CMinimap::loadColors()
std::map<TerrainId, std::pair<SDL_Color, SDL_Color> > CMinimap::loadColors()
{
std::map<TTerrainId, std::pair<SDL_Color, SDL_Color> > ret;
std::map<TerrainId, std::pair<SDL_Color, SDL_Color> > ret;
for(const auto & terrain : CGI->terrainTypeHandler->terrains())
{

View File

@ -222,7 +222,7 @@ protected:
int level;
//to initialize colors
std::map<TTerrainId, std::pair<SDL_Color, SDL_Color> > loadColors();
std::map<TerrainId, std::pair<SDL_Color, SDL_Color> > loadColors();
void clickLeft(tribool down, bool previousState) override;
void clickRight(tribool down, bool previousState) override;
@ -233,7 +233,7 @@ protected:
public:
// terrainID -> (normal color, blocked color)
const std::map<TTerrainId, std::pair<SDL_Color, SDL_Color> > colors;
const std::map<TerrainId, std::pair<SDL_Color, SDL_Color> > colors;
CMinimap(const Rect & position);

View File

@ -285,13 +285,13 @@ std::string CCreature::nodeName() const
return "\"" + namePl + "\"";
}
bool CCreature::isItNativeTerrain(TTerrainId terrain) const
bool CCreature::isItNativeTerrain(TerrainId terrain) const
{
auto native = getNativeTerrain();
return native == terrain || native == Terrain::ANY_TERRAIN;
}
TTerrainId CCreature::getNativeTerrain() const
TerrainId CCreature::getNativeTerrain() const
{
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY";
static const auto selectorNoTerrainPenalty = Selector::type()(Bonus::NO_TERRAIN_PENALTY);

View File

@ -121,14 +121,14 @@ public:
ArtifactID warMachine;
bool isItNativeTerrain(TTerrainId terrain) const;
bool isItNativeTerrain(TerrainId terrain) const;
/**
Returns creature native terrain considering some terrain bonuses.
@param considerBonus is used to avoid Dead Lock when this method is called inside getAllBonuses
considerBonus = true is called from Pathfinder and fills actual nativeTerrain considering bonus(es).
considerBonus = false is called on Battle init and returns already prepared nativeTerrain without Bonus system calling.
*/
TTerrainId getNativeTerrain() const;
TerrainId getNativeTerrain() const;
int32_t getIndex() const override;
int32_t getIconIndex() const override;
const std::string & getName() const override;

View File

@ -124,7 +124,7 @@ public:
std::vector<std::string> advobtxt;
std::vector<std::string> xtrainfo;
std::vector<std::string> restypes; //names of resources
std::map<TTerrainId, std::string> terrainNames;
std::map<TerrainId, std::string> terrainNames;
std::vector<std::string> randsign;
std::vector<std::pair<std::string,std::string>> mines; //first - name; second - event description
std::vector<std::string> seerEmpty;

View File

@ -266,7 +266,7 @@ public:
CHeroClassHandler classes;
//default costs of going through terrains. -1 means terrain is impassable
std::map<TTerrainId, int> terrCosts;
std::map<TerrainId, int> terrCosts;
struct SBallisticsLevelInfo
{

View File

@ -529,7 +529,7 @@ struct DLL_LINKAGE TurnInfo
TConstBonusListPtr bonuses;
mutable int maxMovePointsLand;
mutable int maxMovePointsWater;
TTerrainId nativeTerrain;
TerrainId nativeTerrain;
TurnInfo(const CGHeroInstance * Hero, const int Turn = 0);
bool isLayerAvailable(const EPathfindingLayer layer) const;

View File

@ -334,7 +334,7 @@ bool CStack::isOnNativeTerrain() const
return res;
}
bool CStack::isOnTerrain(TTerrainId terrain) const
bool CStack::isOnTerrain(TerrainId terrain) const
{
return battle->getTerrainType() == terrain;
}

View File

@ -31,7 +31,7 @@ public:
ui32 ID; //unique ID of stack
const CCreature * type;
TTerrainId nativeTerrain; //tmp variable to save native terrain value on battle init
TerrainId nativeTerrain; //tmp variable to save native terrain value on battle init
ui32 baseAmount;
PlayerColor owner; //owner - player color (255 for neutrals)
@ -53,7 +53,7 @@ public:
bool canBeHealed() const; //for first aid tent - only harmed stacks that are not war machines
bool isOnNativeTerrain() const;
bool isOnTerrain(TTerrainId terrain) const;
bool isOnTerrain(TerrainId terrain) const;
ui32 level() const;
si32 magicResistance() const override; //include aura of resistance

View File

@ -28,9 +28,9 @@ VCMI_LIB_NAMESPACE_BEGIN
const int NAMES_PER_TOWN=16; // number of town names per faction in H3 files. Json can define any number
const TTerrainId CTownHandler::defaultGoodTerrain(Terrain::GRASS);
const TTerrainId CTownHandler::defaultEvilTerrain(Terrain::LAVA);
const TTerrainId CTownHandler::defaultNeutralTerrain(Terrain::ROUGH);
const TerrainId CTownHandler::defaultGoodTerrain(Terrain::GRASS);
const TerrainId CTownHandler::defaultEvilTerrain(Terrain::LAVA);
const TerrainId CTownHandler::defaultNeutralTerrain(Terrain::ROUGH);
const std::map<std::string, CBuilding::EBuildMode> CBuilding::MODES =
{
@ -944,9 +944,9 @@ void CTownHandler::loadPuzzle(CFaction &faction, const JsonNode &source)
assert(faction.puzzleMap.size() == GameConstants::PUZZLE_MAP_PIECES);
}
TTerrainId CTownHandler::getDefaultTerrainForAlignment(EAlignment::EAlignment alignment) const
TerrainId CTownHandler::getDefaultTerrainForAlignment(EAlignment::EAlignment alignment) const
{
TTerrainId terrain = defaultGoodTerrain;
TerrainId terrain = defaultGoodTerrain;
switch(alignment)
{

View File

@ -187,7 +187,7 @@ public:
TFaction index;
TTerrainId nativeTerrain;
TerrainId nativeTerrain;
EAlignment::EAlignment alignment;
bool preferUndergroundPlacement;
@ -360,9 +360,9 @@ class DLL_LINKAGE CTownHandler : public CHandlerBase<FactionID, Faction, CFactio
std::vector<BuildingRequirementsHelper> requirementsToLoad;
std::vector<BuildingRequirementsHelper> overriddenBidsToLoad; //list of buildings, which bonuses should be overridden.
const static TTerrainId defaultGoodTerrain;
const static TTerrainId defaultEvilTerrain;
const static TTerrainId defaultNeutralTerrain;
const static TerrainId defaultGoodTerrain;
const static TerrainId defaultEvilTerrain;
const static TerrainId defaultNeutralTerrain;
static TPropagatorPtr & emptyPropagator();
@ -393,7 +393,7 @@ class DLL_LINKAGE CTownHandler : public CHandlerBase<FactionID, Faction, CFactio
void loadPuzzle(CFaction & faction, const JsonNode & source);
TTerrainId getDefaultTerrainForAlignment(EAlignment::EAlignment aligment) const;
TerrainId getDefaultTerrainForAlignment(EAlignment::EAlignment aligment) const;
void loadRandomFaction();

View File

@ -1234,9 +1234,9 @@ typedef si64 TExpType;
typedef std::pair<si64, si64> TDmgRange;
typedef si32 TBonusSubtype;
typedef si32 TQuantity;
typedef si8 TTerrainId;
typedef si8 TRoadId;
typedef si8 TRiverId;
typedef si8 TerrainId;
typedef si8 RoadId;
typedef si8 RiverId;
typedef int TRmgTemplateZoneId;

View File

@ -2113,7 +2113,7 @@ CreatureTerrainLimiter::CreatureTerrainLimiter()
{
}
CreatureTerrainLimiter::CreatureTerrainLimiter(TTerrainId terrain):
CreatureTerrainLimiter::CreatureTerrainLimiter(TerrainId terrain):
terrainType(terrain)
{
}

View File

@ -1062,9 +1062,9 @@ public:
class DLL_LINKAGE CreatureTerrainLimiter : public ILimiter //applies only to creatures that are on specified terrain, default native terrain
{
public:
TTerrainId terrainType;
TerrainId terrainType;
CreatureTerrainLimiter();
CreatureTerrainLimiter(TTerrainId terrain);
CreatureTerrainLimiter(TerrainId terrain);
int limit(const BonusLimitationContext &context) const override;
virtual std::string toString() const override;

View File

@ -703,7 +703,7 @@ DLL_LINKAGE void GiveHero::applyGs(CGameState *gs)
DLL_LINKAGE void NewObject::applyGs(CGameState *gs)
{
TTerrainId terrainType = Terrain::BORDER;
TerrainId terrainType = Terrain::BORDER;
if(ID == Obj::BOAT && !gs->isInTheMap(pos)) //special handling for bug #3060 - pos outside map but visitablePos is not
{

View File

@ -68,7 +68,7 @@ std::vector<BattleHex> ObstacleInfo::getBlocked(BattleHex hex) const
return ret;
}
bool ObstacleInfo::isAppropriate(const TTerrainId terrainType, const BattleField & battlefield) const
bool ObstacleInfo::isAppropriate(const TerrainId terrainType, const BattleField & battlefield) const
{
auto bgInfo = battlefield.getInfo();

View File

@ -33,7 +33,7 @@ public:
si32 iconIndex;
std::string identifier;
std::string appearAnimation, animation, dissapearAnimation;
std::vector<TTerrainId> allowedTerrains;
std::vector<TerrainId> allowedTerrains;
std::vector<std::string> allowedSpecialBfields;
//TODO: here is extra field to implement it's logic in the future but save backward compatibility
@ -52,7 +52,7 @@ public:
std::vector<BattleHex> getBlocked(BattleHex hex) const; //returns vector of hexes blocked by obstacle when it's placed on hex 'hex'
bool isAppropriate(const TTerrainId terrainType, const BattleField & specialBattlefield) const;
bool isAppropriate(const TerrainId terrainType, const BattleField & specialBattlefield) const;
template <typename Handler> void serialize(Handler &h, const int version)
{

View File

@ -149,16 +149,16 @@ void TerrainTypeHandler::initTerrains(const std::vector<std::string> & allConfig
if(!terr.second["originalTerrainId"].isNull())
{
//place in reserved slot
info.id = (TTerrainId)(terr.second["originalTerrainId"].Float());
info.id = (TerrainId)(terr.second["originalTerrainId"].Float());
objects[info.id] = info;
}
else
{
//append at the end
info.id = static_cast<TTerrainId>(objects.size());
info.id = static_cast<TerrainId>(objects.size());
objects.push_back(info);
}
TTerrainId id = info.id;
TerrainId id = info.id;
//Update terrain with this id in the future, after all terrain types are populated
@ -226,12 +226,12 @@ void TerrainTypeHandler::initRivers(const std::vector<std::string> & allConfigs)
if (!river.second["originalRiverId"].isNull())
{
info.id = static_cast<TRiverId>(river.second["originalRiverId"].Float());
info.id = static_cast<RiverId>(river.second["originalRiverId"].Float());
riverTypes[info.id] = info;
}
else
{
info.id = static_cast<TRiverId>(riverTypes.size());
info.id = static_cast<RiverId>(riverTypes.size());
riverTypes.push_back(info);
}
}
@ -261,12 +261,12 @@ void TerrainTypeHandler::initRoads(const std::vector<std::string> & allConfigs)
if (!road.second["originalRoadId"].isNull())
{
info.id = static_cast<TRoadId>(road.second["originalRoadId"].Float());
info.id = static_cast<RoadId>(road.second["originalRoadId"].Float());
roadTypes[info.id] = info;
}
else
{
info.id = static_cast<TRoadId>(roadTypes.size());
info.id = static_cast<RoadId>(roadTypes.size());
roadTypes.push_back(info);
}
}
@ -339,7 +339,7 @@ const TerrainType* TerrainTypeHandler::getInfoByCode(const std::string& terrainC
return terrainInfoByCode.at(terrainCode);
}
const TerrainType* TerrainTypeHandler::getInfoById(TTerrainId id) const
const TerrainType* TerrainTypeHandler::getInfoById(TerrainId id) const
{
return terrainInfoById.at(id);
}
@ -354,7 +354,7 @@ const RiverType* TerrainTypeHandler::getRiverByCode(const std::string& riverCode
return riverInfoByCode.at(riverCode);
}
const RiverType* TerrainTypeHandler::getRiverById(TRiverId id) const
const RiverType* TerrainTypeHandler::getRiverById(RiverId id) const
{
return riverInfoById.at(id);
}
@ -369,7 +369,7 @@ const RoadType* TerrainTypeHandler::getRoadByCode(const std::string& roadCode) c
return roadInfoByCode.at(roadCode);
}
const RoadType* TerrainTypeHandler::getRoadById(TRoadId id) const
const RoadType* TerrainTypeHandler::getRoadById(RoadId id) const
{
return roadInfoById.at(id);
}
@ -467,7 +467,7 @@ bool TerrainType::isTransitionRequired() const
return transitionRequired;
}
RiverType::RiverType(const std::string & fileName, const std::string & code, TRiverId id):
RiverType::RiverType(const std::string & fileName, const std::string & code, RiverId id):
fileName(fileName),
code(code),
id(id)
@ -484,7 +484,7 @@ RiverType& RiverType::operator=(const RiverType& other)
return *this;
}
RoadType::RoadType(const std::string& fileName, const std::string& code, TRoadId id):
RoadType::RoadType(const std::string& fileName, const std::string& code, RoadId id):
fileName(fileName),
code(code),
id(id),

View File

@ -30,7 +30,7 @@ public:
};
std::vector<std::string> battleFields;
std::vector<TTerrainId> prohibitTransitions;
std::vector<TerrainId> prohibitTransitions;
std::array<int, 3> minimapBlocked;
std::array<int, 3> minimapUnblocked;
std::string name;
@ -39,10 +39,10 @@ public:
std::string terrainText;
std::string typeCode;
std::string terrainViewPatterns;
TRiverId river;
RiverId river;
TTerrainId id;
TTerrainId rockTerrain;
TerrainId id;
TerrainId rockTerrain;
int moveCost;
int horseSoundId;
ui8 passabilityType;
@ -95,9 +95,9 @@ public:
std::string fileName;
std::string code;
std::string deltaName;
TRiverId id;
RiverId id;
RiverType(const std::string & fileName = "", const std::string & code = "", TRiverId id = River::NO_RIVER);
RiverType(const std::string & fileName = "", const std::string & code = "", RiverId id = River::NO_RIVER);
RiverType& operator=(const RiverType & other);
@ -115,10 +115,10 @@ class DLL_LINKAGE RoadType
public:
std::string fileName;
std::string code;
TRoadId id;
RoadId id;
ui8 movementCost;
RoadType(const std::string & fileName = "", const std::string& code = "", TRoadId id = Road::NO_ROAD);
RoadType(const std::string & fileName = "", const std::string& code = "", RoadId id = Road::NO_ROAD);
RoadType& operator=(const RoadType & other);
@ -143,17 +143,17 @@ public:
const std::vector<TerrainType> & terrains() const;
const TerrainType * getInfoByName(const std::string & terrainName) const;
const TerrainType * getInfoByCode(const std::string & terrainCode) const;
const TerrainType * getInfoById(TTerrainId id) const;
const TerrainType * getInfoById(TerrainId id) const;
const std::vector<RiverType> & rivers() const;
const RiverType * getRiverByName(const std::string & riverName) const;
const RiverType * getRiverByCode(const std::string & riverCode) const;
const RiverType * getRiverById(TRiverId id) const;
const RiverType * getRiverById(RiverId id) const;
const std::vector<RoadType> & roads() const;
const RoadType * getRoadByName(const std::string & roadName) const;
const RoadType * getRoadByCode(const std::string & roadCode) const;
const RoadType * getRoadById(TRoadId id) const;
const RoadType * getRoadById(RoadId id) const;
template <typename Handler> void serialize(Handler &h, const int version)
{
@ -177,15 +177,15 @@ private:
std::unordered_map<std::string, const TerrainType*> terrainInfoByName;
std::unordered_map<std::string, const TerrainType*> terrainInfoByCode;
std::unordered_map<TTerrainId, const TerrainType*> terrainInfoById;
std::unordered_map<TerrainId, const TerrainType*> terrainInfoById;
std::unordered_map<std::string, const RiverType*> riverInfoByName;
std::unordered_map<std::string, const RiverType*> riverInfoByCode;
std::unordered_map<TRiverId, const RiverType*> riverInfoById;
std::unordered_map<RiverId, const RiverType*> riverInfoById;
std::unordered_map<std::string, const RoadType*> roadInfoByName;
std::unordered_map<std::string, const RoadType*> roadInfoByCode;
std::unordered_map<TRoadId, const RoadType*> roadInfoById;
std::unordered_map<RoadId, const RoadType*> roadInfoById;
void initTerrains(const std::vector<std::string> & allConfigs);
void initRivers(const std::vector<std::string> & allConfigs);

View File

@ -191,7 +191,7 @@ struct RangeGenerator
std::function<int()> myRand;
};
BattleInfo * BattleInfo::setupBattle(const int3 & tile, TTerrainId terrain, const BattleField & battlefieldType, const CArmedInstance * armies[2], const CGHeroInstance * heroes[2], bool creatureBank, const CGTownInstance * town)
BattleInfo * BattleInfo::setupBattle(const int3 & tile, TerrainId terrain, const BattleField & battlefieldType, const CArmedInstance * armies[2], const CGHeroInstance * heroes[2], bool creatureBank, const CGTownInstance * town)
{
CMP_stack cmpst;
auto curB = new BattleInfo();
@ -565,7 +565,7 @@ BattleField BattleInfo::getBattlefieldType() const
return battlefieldType;
}
TTerrainId BattleInfo::getTerrainType() const
TerrainId BattleInfo::getTerrainType() const
{
return terrainType;
}

View File

@ -39,7 +39,7 @@ public:
SiegeInfo si;
BattleField battlefieldType; //like !!BA:B
TTerrainId terrainType; //used for some stack nativity checks (not the bonus limiters though that have their own copy)
TerrainId terrainType; //used for some stack nativity checks (not the bonus limiters though that have their own copy)
ui8 tacticsSide; //which side is requested to play tactics phase
ui8 tacticDistance; //how many hexes we can go forward (1 = only hexes adjacent to margin line)
@ -75,7 +75,7 @@ public:
battle::Units getUnitsIf(battle::UnitFilter predicate) const override;
BattleField getBattlefieldType() const override;
TTerrainId getTerrainType() const override;
TerrainId getTerrainType() const override;
ObstacleCList getAllObstacles() const override;
@ -140,7 +140,7 @@ public:
const CGHeroInstance * getHero(PlayerColor player) const; //returns fighting hero that belongs to given player
void localInit();
static BattleInfo * setupBattle(const int3 & tile, TTerrainId, const BattleField & battlefieldType, const CArmedInstance * armies[2], const CGHeroInstance * heroes[2], bool creatureBank, const CGTownInstance * town);
static BattleInfo * setupBattle(const int3 & tile, TerrainId, const BattleField & battlefieldType, const CArmedInstance * armies[2], const CGHeroInstance * heroes[2], bool creatureBank, const CGTownInstance * town);
ui8 whatSide(PlayerColor player) const;

View File

@ -49,7 +49,7 @@ BattleField BattleProxy::getBattlefieldType() const
return subject->battleGetBattlefieldType();
}
TTerrainId BattleProxy::getTerrainType() const
TerrainId BattleProxy::getTerrainType() const
{
return subject->battleTerrainType();
}

View File

@ -32,7 +32,7 @@ public:
battle::Units getUnitsIf(battle::UnitFilter predicate) const override;
BattleField getBattlefieldType() const override;
TTerrainId getTerrainType() const override;
TerrainId getTerrainType() const override;
ObstacleCList getAllObstacles() const override;

View File

@ -16,9 +16,9 @@
VCMI_LIB_NAMESPACE_BEGIN
TTerrainId CBattleInfoEssentials::battleTerrainType() const
TerrainId CBattleInfoEssentials::battleTerrainType() const
{
RETURN_IF_NOT_BATTLE(TTerrainId());
RETURN_IF_NOT_BATTLE(TerrainId());
return getBattle()->getTerrainType();
}

View File

@ -48,7 +48,7 @@ public:
BattlePerspective::BattlePerspective battleGetMySide() const;
const IBonusBearer * getBattleNode() const;
TTerrainId battleTerrainType() const override;
TerrainId battleTerrainType() const override;
BattleField battleGetBattlefieldType() const override;
int32_t battleGetEnchanterCounter(ui8 side) const;

View File

@ -40,7 +40,7 @@ public:
virtual scripting::Pool * getContextPool() const = 0;
#endif
virtual TTerrainId battleTerrainType() const = 0;
virtual TerrainId battleTerrainType() const = 0;
virtual BattleField battleGetBattlefieldType() const = 0;
///return none if battle is ongoing; otherwise the victorious side (0/1) or 2 if it is a draw

View File

@ -44,7 +44,7 @@ public:
virtual battle::Units getUnitsIf(battle::UnitFilter predicate) const = 0;
virtual BattleField getBattlefieldType() const = 0;
virtual TTerrainId getTerrainType() const = 0;
virtual TerrainId getTerrainType() const = 0;
virtual ObstacleCList getAllObstacles() const = 0;

View File

@ -98,7 +98,7 @@ ui32 CGHeroInstance::getTileCost(const TerrainTile & dest, const TerrainTile & f
return (ui32)ret;
}
TTerrainId CGHeroInstance::getNativeTerrain() const
TerrainId CGHeroInstance::getNativeTerrain() const
{
// NOTE: in H3 neutral stacks will ignore terrain penalty only if placed as topmost stack(s) in hero army.
// This is clearly bug in H3 however intended behaviour is not clear.
@ -106,11 +106,11 @@ TTerrainId CGHeroInstance::getNativeTerrain() const
// will always have best penalty without any influence from player-defined stacks order
// TODO: What should we do if all hero stacks are neutral creatures?
TTerrainId nativeTerrain = Terrain::BORDER;
TerrainId nativeTerrain = Terrain::BORDER;
for(auto stack : stacks)
{
TTerrainId stackNativeTerrain = stack.second->type->getNativeTerrain(); //consider terrain bonuses e.g. Lodestar.
TerrainId stackNativeTerrain = stack.second->type->getNativeTerrain(); //consider terrain bonuses e.g. Lodestar.
if(stackNativeTerrain == Terrain::BORDER) //where does this value come from?
continue;

View File

@ -157,7 +157,7 @@ public:
bool needsLastStack()const override;
ui32 getTileCost(const TerrainTile &dest, const TerrainTile &from, const TurnInfo * ti) const; //move cost - applying pathfinding skill, road and terrain modifiers. NOT includes diagonal move penalty, last move levelling
TTerrainId getNativeTerrain() const;
TerrainId getNativeTerrain() const;
ui32 getLowestCreatureSpeed() const;
int3 getPosition(bool h3m = false) const; //h3m=true - returns position of hero object; h3m=false - returns position of hero 'manifestation'
si32 manaRegain() const; //how many points of mana can hero regain "naturally" in one day

View File

@ -590,7 +590,7 @@ BattleField AObjectTypeHandler::getBattlefield() const
return battlefield ? BattleField::fromString(battlefield.get()) : BattleField::NONE;
}
std::vector<std::shared_ptr<const ObjectTemplate>>AObjectTypeHandler::getTemplates(TTerrainId terrainType) const
std::vector<std::shared_ptr<const ObjectTemplate>>AObjectTypeHandler::getTemplates(TerrainId terrainType) const
{
std::vector<std::shared_ptr<const ObjectTemplate>> templates = getTemplates();
std::vector<std::shared_ptr<const ObjectTemplate>> filtered;
@ -607,7 +607,7 @@ std::vector<std::shared_ptr<const ObjectTemplate>>AObjectTypeHandler::getTemplat
return filtered;
}
std::shared_ptr<const ObjectTemplate> AObjectTypeHandler::getOverride(TTerrainId terrainType, const CGObjectInstance * object) const
std::shared_ptr<const ObjectTemplate> AObjectTypeHandler::getOverride(TerrainId terrainType, const CGObjectInstance * object) const
{
std::vector<std::shared_ptr<const ObjectTemplate>> ret = getTemplates(terrainType);
for (const auto & tmpl: ret)

View File

@ -184,11 +184,11 @@ public:
/// returns all templates matching parameters
std::vector<std::shared_ptr<const ObjectTemplate>> getTemplates() const;
std::vector<std::shared_ptr<const ObjectTemplate>> getTemplates(const TTerrainId terrainType) const;
std::vector<std::shared_ptr<const ObjectTemplate>> getTemplates(const TerrainId terrainType) const;
/// returns preferred template for this object, if present (e.g. one of 3 possible templates for town - village, fort and castle)
/// note that appearance will not be changed - this must be done separately (either by assignment or via pack from server)
std::shared_ptr<const ObjectTemplate> getOverride(TTerrainId terrainType, const CGObjectInstance * object) const;
std::shared_ptr<const ObjectTemplate> getOverride(TerrainId terrainType, const CGObjectInstance * object) const;
BattleField getBattlefield() const;

View File

@ -158,7 +158,7 @@ void ObjectTemplate::readTxt(CLegacyConfigParser & parser)
std::string & terrStr = strings[4]; // allowed terrains, 1 = object can be placed on this terrain
assert(terrStr.size() == Terrain::ROCK - 1); // all terrains but rock
for(TTerrainId i = Terrain::FIRST_REGULAR_TERRAIN; i < Terrain::ROCK; i++)
for(TerrainId i = Terrain::FIRST_REGULAR_TERRAIN; i < Terrain::ROCK; i++)
{
if (terrStr[8-i] == '1')
allowedTerrains.insert(i);
@ -557,7 +557,7 @@ void ObjectTemplate::calculateVisitableOffset()
visitableOffset = int3(0, 0, 0);
}
bool ObjectTemplate::canBePlacedAt(TTerrainId terrain) const
bool ObjectTemplate::canBePlacedAt(TerrainId terrain) const
{
return vstd::contains(allowedTerrains, terrain);
}

View File

@ -33,7 +33,7 @@ class DLL_LINKAGE ObjectTemplate
/// directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
ui8 visitDir;
/// list of terrains on which this object can be placed
std::set<TTerrainId> allowedTerrains;
std::set<TerrainId> allowedTerrains;
void afterLoadFixup();
@ -100,7 +100,7 @@ public:
};
// Checks if object can be placed on specific terrain
bool canBePlacedAt(TTerrainId terrain) const;
bool canBePlacedAt(TerrainId terrain) const;
ObjectTemplate();
//custom copy constructor is required

View File

@ -158,14 +158,14 @@ CDrawLinesOperation::CDrawLinesOperation(CMap * map, const CTerrainSelection & t
}
///CDrawRoadsOperation
CDrawRoadsOperation::CDrawRoadsOperation(CMap * map, const CTerrainSelection & terrainSel, TRoadId roadType, CRandomGenerator * gen):
CDrawRoadsOperation::CDrawRoadsOperation(CMap * map, const CTerrainSelection & terrainSel, RoadId roadType, CRandomGenerator * gen):
CDrawLinesOperation(map, terrainSel,gen),
roadType(roadType)
{
}
///CDrawRiversOperation
CDrawRiversOperation::CDrawRiversOperation(CMap * map, const CTerrainSelection & terrainSel, TRiverId riverType, CRandomGenerator * gen):
CDrawRiversOperation::CDrawRiversOperation(CMap * map, const CTerrainSelection & terrainSel, RiverId riverType, CRandomGenerator * gen):
CDrawLinesOperation(map, terrainSel, gen),
riverType(riverType)
{

View File

@ -63,7 +63,7 @@ protected:
class CDrawRoadsOperation : public CDrawLinesOperation
{
public:
CDrawRoadsOperation(CMap * map, const CTerrainSelection & terrainSel, TRoadId roadType, CRandomGenerator * gen);
CDrawRoadsOperation(CMap * map, const CTerrainSelection & terrainSel, RoadId roadType, CRandomGenerator * gen);
std::string getLabel() const override;
protected:
@ -74,13 +74,13 @@ protected:
void updateTile(TerrainTile & tile, const CDrawLinesOperation::LinePattern & pattern, const int flip) override;
private:
TRoadId roadType;
RoadId roadType;
};
class CDrawRiversOperation : public CDrawLinesOperation
{
public:
CDrawRiversOperation(CMap * map, const CTerrainSelection & terrainSel, TRoadId roadType, CRandomGenerator * gen);
CDrawRiversOperation(CMap * map, const CTerrainSelection & terrainSel, RoadId roadType, CRandomGenerator * gen);
std::string getLabel() const override;
protected:
@ -91,7 +91,7 @@ protected:
void updateTile(TerrainTile & tile, const CDrawLinesOperation::LinePattern & pattern, const int flip) override;
private:
TRiverId riverType;
RiverId riverType;
};
VCMI_LIB_NAMESPACE_END

View File

@ -126,19 +126,19 @@ void CMapEditManager::clearTerrain(CRandomGenerator * gen)
execute(make_unique<CClearTerrainOperation>(map, gen ? gen : &(this->gen)));
}
void CMapEditManager::drawTerrain(TTerrainId terType, CRandomGenerator * gen)
void CMapEditManager::drawTerrain(TerrainId terType, CRandomGenerator * gen)
{
execute(make_unique<CDrawTerrainOperation>(map, terrainSel, terType, gen ? gen : &(this->gen)));
terrainSel.clearSelection();
}
void CMapEditManager::drawRoad(TRoadId roadType, CRandomGenerator* gen)
void CMapEditManager::drawRoad(RoadId roadType, CRandomGenerator* gen)
{
execute(make_unique<CDrawRoadsOperation>(map, terrainSel, roadType, gen ? gen : &(this->gen)));
terrainSel.clearSelection();
}
void CMapEditManager::drawRiver(TRiverId riverType, CRandomGenerator* gen)
void CMapEditManager::drawRiver(RiverId riverType, CRandomGenerator* gen)
{
execute(make_unique<CDrawRiversOperation>(map, terrainSel, riverType, gen ? gen : &(this->gen)));
terrainSel.clearSelection();

View File

@ -72,13 +72,13 @@ public:
void clearTerrain(CRandomGenerator * gen = nullptr);
/// Draws terrain at the current terrain selection. The selection will be cleared automatically.
void drawTerrain(TTerrainId terType, CRandomGenerator * gen = nullptr);
void drawTerrain(TerrainId terType, CRandomGenerator * gen = nullptr);
/// Draws roads at the current terrain selection. The selection will be cleared automatically.
void drawRoad(TRoadId roadType, CRandomGenerator * gen = nullptr);
void drawRoad(RoadId roadType, CRandomGenerator * gen = nullptr);
/// Draws rivers at the current terrain selection. The selection will be cleared automatically.
void drawRiver(TRiverId riverType, CRandomGenerator * gen = nullptr);
void drawRiver(RiverId riverType, CRandomGenerator * gen = nullptr);
void insertObject(CGObjectInstance * obj);
void insertObjects(std::set<CGObjectInstance *> & objects);

View File

@ -83,7 +83,7 @@ void CComposedOperation::addOperation(std::unique_ptr<CMapOperation>&& operation
operations.push_back(std::move(operation));
}
CDrawTerrainOperation::CDrawTerrainOperation(CMap* map, const CTerrainSelection& terrainSel, TTerrainId terType, CRandomGenerator* gen):
CDrawTerrainOperation::CDrawTerrainOperation(CMap* map, const CTerrainSelection& terrainSel, TerrainId terType, CRandomGenerator* gen):
CMapOperation(map),
terrainSel(terrainSel),
terType(terType),

View File

@ -63,7 +63,7 @@ private:
class CDrawTerrainOperation : public CMapOperation
{
public:
CDrawTerrainOperation(CMap * map, const CTerrainSelection & terrainSel, TTerrainId terType, CRandomGenerator * gen);
CDrawTerrainOperation(CMap * map, const CTerrainSelection & terrainSel, TerrainId terType, CRandomGenerator * gen);
void execute() override;
void undo() override;
@ -100,7 +100,7 @@ private:
ValidationResult validateTerrainViewInner(const int3 & pos, const TerrainViewPattern & pattern, int recDepth = 0) const;
CTerrainSelection terrainSel;
TTerrainId terType;
TerrainId terType;
CRandomGenerator* gen;
std::set<int3> invalidatedTerViews;
};

View File

@ -270,7 +270,7 @@ CTerrainViewPatternConfig::~CTerrainViewPatternConfig()
}
const std::vector<CTerrainViewPatternConfig::TVPVector> & CTerrainViewPatternConfig::getTerrainViewPatterns(TTerrainId terrain) const
const std::vector<CTerrainViewPatternConfig::TVPVector> & CTerrainViewPatternConfig::getTerrainViewPatterns(TerrainId terrain) const
{
auto iter = terrainViewPatterns.find(VLC->terrainTypeHandler->terrains()[terrain].terrainViewPatterns);
if (iter == terrainViewPatterns.end())
@ -295,7 +295,7 @@ boost::optional<const TerrainViewPattern &> CTerrainViewPatternConfig::getTerrai
return boost::optional<const TerrainViewPattern&>();
}
boost::optional<const CTerrainViewPatternConfig::TVPVector &> CTerrainViewPatternConfig::getTerrainViewPatternsById(TTerrainId terrain, const std::string & id) const
boost::optional<const CTerrainViewPatternConfig::TVPVector &> CTerrainViewPatternConfig::getTerrainViewPatternsById(TerrainId terrain, const std::string & id) const
{
const std::vector<TVPVector> & groupPatterns = getTerrainViewPatterns(terrain);
for (const TVPVector & patternFlips : groupPatterns)

View File

@ -217,9 +217,9 @@ public:
CTerrainViewPatternConfig();
~CTerrainViewPatternConfig();
const std::vector<TVPVector> & getTerrainViewPatterns(TTerrainId terrain) const;
const std::vector<TVPVector> & getTerrainViewPatterns(TerrainId terrain) const;
boost::optional<const TerrainViewPattern &> getTerrainViewPatternById(std::string patternId, const std::string & id) const;
boost::optional<const TVPVector &> getTerrainViewPatternsById(TTerrainId terrain, const std::string & id) const;
boost::optional<const TVPVector &> getTerrainViewPatternsById(TerrainId terrain, const std::string & id) const;
const TVPVector * getTerrainTypePatternById(const std::string & id) const;
void flipPattern(TerrainViewPattern & pattern, int flip) const;

View File

@ -217,12 +217,12 @@ boost::optional<int> ZoneOptions::getOwner() const
return owner;
}
const std::set<TTerrainId> & ZoneOptions::getTerrainTypes() const
const std::set<TerrainId> & ZoneOptions::getTerrainTypes() const
{
return terrainTypes;
}
void ZoneOptions::setTerrainTypes(const std::set<TTerrainId> & value)
void ZoneOptions::setTerrainTypes(const std::set<TerrainId> & value)
{
//assert(value.find(ETerrainType::WRONG) == value.end() && value.find(ETerrainType::BORDER) == value.end() &&
// value.find(ETerrainType::WATER) == value.end() && value.find(ETerrainType::ROCK) == value.end());

View File

@ -105,8 +105,8 @@ public:
void setSize(int value);
boost::optional<int> getOwner() const;
const std::set<TTerrainId> & getTerrainTypes() const;
void setTerrainTypes(const std::set<TTerrainId> & value);
const std::set<TerrainId> & getTerrainTypes() const;
void setTerrainTypes(const std::set<TerrainId> & value);
const CTownInfo & getPlayerTowns() const;
const CTownInfo & getNeutralTowns() const;
@ -146,7 +146,7 @@ protected:
CTownInfo playerTowns;
CTownInfo neutralTowns;
bool matchTerrainToTown;
std::set<TTerrainId> terrainTypes;
std::set<TerrainId> terrainTypes;
bool townsAreSameType;
std::set<TFaction> townTypes;

View File

@ -95,14 +95,14 @@ void createBorder(RmgMap & gen, Zone & zone)
}
}
void paintZoneTerrain(const Zone & zone, CRandomGenerator & generator, RmgMap & map, TTerrainId terrain)
void paintZoneTerrain(const Zone & zone, CRandomGenerator & generator, RmgMap & map, TerrainId terrain)
{
auto v = zone.getArea().getTilesVector();
map.getEditManager()->getTerrainSelection().setSelection(v);
map.getEditManager()->drawTerrain(terrain, &generator);
}
int chooseRandomAppearance(CRandomGenerator & generator, si32 ObjID, TTerrainId terrain)
int chooseRandomAppearance(CRandomGenerator & generator, si32 ObjID, TerrainId terrain)
{
auto factories = VLC->objtypeh->knownSubObjects(ObjID);
vstd::erase_if(factories, [ObjID, &terrain](si32 f)
@ -118,7 +118,7 @@ void initTerrainType(Zone & zone, CMapGenerator & gen)
if(zone.getType()==ETemplateZoneType::WATER)
{
//collect all water terrain types
std::vector<TTerrainId> waterTerrains;
std::vector<TerrainId> waterTerrains;
for(const auto & terrain : VLC->terrainTypeHandler->terrains())
if(terrain.isWater())
waterTerrains.push_back(terrain.id);

View File

@ -42,11 +42,11 @@ rmg::Tileset collectDistantTiles(const Zone & zone, int distance);
void createBorder(RmgMap & gen, Zone & zone);
void paintZoneTerrain(const Zone & zone, CRandomGenerator & generator, RmgMap & map, TTerrainId terrainType);
void paintZoneTerrain(const Zone & zone, CRandomGenerator & generator, RmgMap & map, TerrainId terrainType);
void initTerrainType(Zone & zone, CMapGenerator & gen);
int chooseRandomAppearance(CRandomGenerator & generator, si32 ObjID, TTerrainId terrain);
int chooseRandomAppearance(CRandomGenerator & generator, si32 ObjID, TerrainId terrain);
VCMI_LIB_NAMESPACE_END

View File

@ -26,7 +26,7 @@
VCMI_LIB_NAMESPACE_BEGIN
void ObstacleProxy::collectPossibleObstacles(TTerrainId terrain)
void ObstacleProxy::collectPossibleObstacles(TerrainId terrain)
{
//get all possible obstacles for this terrain
for(auto primaryID : VLC->objtypeh->knownObjects())

View File

@ -26,7 +26,7 @@ public:
rmg::Area blockedArea;
void collectPossibleObstacles(TTerrainId terrain);
void collectPossibleObstacles(TerrainId terrain);
void placeObstacles(CMap * map, CRandomGenerator & rand);

View File

@ -231,7 +231,7 @@ void RmgMap::setOccupied(const int3 &tile, ETileType::ETileType state)
tiles[tile.x][tile.y][tile.z].setOccupied(state);
}
void RmgMap::setRoad(const int3& tile, TRoadId roadType)
void RmgMap::setRoad(const int3& tile, RoadId roadType)
{
assertOnMap(tile);

View File

@ -46,7 +46,7 @@ public:
bool isOnMap(const int3 & tile) const;
void setOccupied(const int3 &tile, ETileType::ETileType state);
void setRoad(const int3 &tile, TRoadId roadType);
void setRoad(const int3 &tile, RoadId roadType);
TileInfo getTile(const int3 & tile) const;

View File

@ -105,7 +105,7 @@ void Object::Instance::setPositionRaw(const int3 & position)
dObject.pos = dPosition + dParent.getPosition();
}
void Object::Instance::setTemplate(const TTerrainId & terrain)
void Object::Instance::setTemplate(const TerrainId & terrain)
{
if(dObject.appearance->id == Obj::NO_OBJ)
{
@ -259,7 +259,7 @@ void Object::setPosition(const int3 & position)
i.setPositionRaw(i.getPosition());
}
void Object::setTemplate(const TTerrainId & terrain)
void Object::setTemplate(const TerrainId & terrain)
{
for(auto& i : dInstances)
i.setTemplate(terrain);

View File

@ -35,7 +35,7 @@ public:
int3 getVisitablePosition() const;
bool isVisitableFrom(const int3 & tile) const;
const Area & getAccessibleArea() const;
void setTemplate(const TTerrainId & terrain); //cache invalidation
void setTemplate(const TerrainId & terrain); //cache invalidation
int3 getPosition(bool isAbsolute = false) const;
void setPosition(const int3 & position); //cache invalidation
@ -71,7 +71,7 @@ public:
const int3 & getPosition() const;
void setPosition(const int3 & position);
void setTemplate(const TTerrainId & terrain);
void setTemplate(const TerrainId & terrain);
const Area & getArea() const; //lazy cache invalidation

View File

@ -72,7 +72,7 @@ void RoadPlacer::drawRoads(bool secondary)
zone.freePaths().unite(roads);
map.getEditManager()->getTerrainSelection().setSelection(roads.getTilesVector());
std::string roadCode = (secondary ? generator.getConfig().secondaryRoadType : generator.getConfig().defaultRoadType);
TRoadId roadType = VLC->terrainTypeHandler->getRoadByCode(roadCode)->id;
RoadId roadType = VLC->terrainTypeHandler->getRoadByCode(roadCode)->id;
map.getEditManager()->drawRoad(roadType, &generator.rand);
}

View File

@ -28,7 +28,7 @@ public:
protected:
rmg::Area rockArea, accessibleArea;
TTerrainId rockTerrain;
TerrainId rockTerrain;
};
VCMI_LIB_NAMESPACE_END

View File

@ -63,17 +63,17 @@ ETileType::ETileType TileInfo::getTileType() const
return occupied;
}
TTerrainId TileInfo::getTerrainType() const
TerrainId TileInfo::getTerrainType() const
{
return terrain;
}
void TileInfo::setTerrainType(TTerrainId type)
void TileInfo::setTerrainType(TerrainId type)
{
terrain = type;
}
void TileInfo::setRoadType(TRoadId type)
void TileInfo::setRoadType(RoadId type)
{
roadType = type;
// setOccupied(ETileType::FREE);

View File

@ -30,16 +30,16 @@ public:
bool isUsed() const;
bool isRoad() const;
void setOccupied(ETileType::ETileType value);
TTerrainId getTerrainType() const;
TerrainId getTerrainType() const;
ETileType::ETileType getTileType() const;
void setTerrainType(TTerrainId value);
void setTerrainType(TerrainId value);
void setRoadType(TRoadId type);
void setRoadType(RoadId type);
private:
float nearestObjectDistance;
ETileType::ETileType occupied;
TTerrainId terrain;
TRoadId roadType;
TerrainId terrain;
RoadId roadType;
};
VCMI_LIB_NAMESPACE_END

View File

@ -813,7 +813,7 @@ ObjectInfo::ObjectInfo()
}
void ObjectInfo::setTemplate(si32 type, si32 subtype, TTerrainId terrainType)
void ObjectInfo::setTemplate(si32 type, si32 subtype, TerrainId terrainType)
{
auto templHandler = VLC->objtypeh->getHandlerFor(type, subtype);
if(!templHandler)

View File

@ -28,7 +28,7 @@ struct ObjectInfo
//ui32 maxPerMap; //unused
std::function<CGObjectInstance *()> generateObject;
void setTemplate(si32 type, si32 subtype, TTerrainId terrain);
void setTemplate(si32 type, si32 subtype, TerrainId terrain);
ObjectInfo();

View File

@ -134,12 +134,12 @@ void Zone::setTownType(si32 town)
townType = town;
}
TTerrainId Zone::getTerrainType() const
TerrainId Zone::getTerrainType() const
{
return terrainType;
}
void Zone::setTerrainType(TTerrainId terrain)
void Zone::setTerrainType(TerrainId terrain)
{
terrainType = terrain;
}

View File

@ -100,8 +100,8 @@ public:
si32 getTownType() const;
void setTownType(si32 town);
TTerrainId getTerrainType() const;
void setTerrainType(TTerrainId terrain);
TerrainId getTerrainType() const;
void setTerrainType(TerrainId terrain);
void connectPath(const rmg::Path & path);
rmg::Path searchPath(const rmg::Area & src, bool onlyStraight, std::function<bool(const int3 &)> areafilter = AREA_NO_FILTER) const;
@ -140,7 +140,7 @@ protected:
//template info
si32 townType;
TTerrainId terrainType;
TerrainId terrainType;
};

View File

@ -2241,7 +2241,7 @@ void CGameHandler::setupBattle(int3 tile, const CArmedInstance *armies[2], const
battleResult.set(nullptr);
const auto & t = *getTile(tile);
TTerrainId terrain = t.terType->id;
TerrainId terrain = t.terType->id;
if (gs->map->isCoastalTile(tile)) //coastal tile is always ground
terrain = Terrain::SAND;

View File

@ -193,7 +193,7 @@ public:
const auto & t = *gameCallback->getTile(tile);
TTerrainId terrain = t.terType->id;
TerrainId terrain = t.terType->id;
BattleField terType = BattleField::fromString("grass_hills");
//send info about battles

View File

@ -17,7 +17,7 @@ class IBattleInfoCallbackMock : public IBattleInfoCallback
{
public:
MOCK_CONST_METHOD0(getContextPool, scripting::Pool *());
MOCK_CONST_METHOD0(battleTerrainType, TTerrainId());
MOCK_CONST_METHOD0(battleTerrainType, TerrainId());
MOCK_CONST_METHOD0(battleGetBattlefieldType, BattleField());
MOCK_CONST_METHOD0(battleIsFinished, boost::optional<int>());

View File

@ -19,7 +19,7 @@ public:
MOCK_CONST_METHOD1(getStacksIf, TStacks(TStackFilter));
MOCK_CONST_METHOD1(getUnitsIf, battle::Units(battle::UnitFilter));
MOCK_CONST_METHOD0(getBattlefieldType, BattleField());
MOCK_CONST_METHOD0(getTerrainType, TTerrainId());
MOCK_CONST_METHOD0(getTerrainType, TerrainId());
MOCK_CONST_METHOD0(getAllObstacles, IBattleInfo::ObstacleCList());
MOCK_CONST_METHOD0(getDefendedTown, const CGTownInstance *());
MOCK_CONST_METHOD1(getWallState, si8(int));