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:
parent
475f835769
commit
20c102e648
@ -84,7 +84,7 @@ public:
|
|||||||
// Sets
|
// Sets
|
||||||
std::vector<soundBase::soundID> pickupSounds;
|
std::vector<soundBase::soundID> pickupSounds;
|
||||||
std::vector<soundBase::soundID> battleIntroSounds;
|
std::vector<soundBase::soundID> battleIntroSounds;
|
||||||
std::map<TTerrainId, soundBase::soundID> horseSounds;
|
std::map<TerrainId, soundBase::soundID> horseSounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper //now it looks somewhat useless
|
// Helper //now it looks somewhat useless
|
||||||
|
@ -2746,8 +2746,8 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
|
|||||||
|
|
||||||
{
|
{
|
||||||
path.convert(0);
|
path.convert(0);
|
||||||
TTerrainId currentTerrain = Terrain::BORDER; // not init yet
|
TerrainId currentTerrain = Terrain::BORDER; // not init yet
|
||||||
TTerrainId newTerrain;
|
TerrainId newTerrain;
|
||||||
int sh = -1;
|
int sh = -1;
|
||||||
|
|
||||||
auto canStop = [&](CGPathNode * node) -> bool
|
auto canStop = [&](CGPathNode * node) -> bool
|
||||||
|
@ -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())
|
for(const auto & terrain : CGI->terrainTypeHandler->terrains())
|
||||||
{
|
{
|
||||||
|
@ -222,7 +222,7 @@ protected:
|
|||||||
int level;
|
int level;
|
||||||
|
|
||||||
//to initialize colors
|
//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 clickLeft(tribool down, bool previousState) override;
|
||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
@ -233,7 +233,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// terrainID -> (normal color, blocked color)
|
// 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);
|
CMinimap(const Rect & position);
|
||||||
|
|
||||||
|
@ -285,13 +285,13 @@ std::string CCreature::nodeName() const
|
|||||||
return "\"" + namePl + "\"";
|
return "\"" + namePl + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCreature::isItNativeTerrain(TTerrainId terrain) const
|
bool CCreature::isItNativeTerrain(TerrainId terrain) const
|
||||||
{
|
{
|
||||||
auto native = getNativeTerrain();
|
auto native = getNativeTerrain();
|
||||||
return native == terrain || native == Terrain::ANY_TERRAIN;
|
return native == terrain || native == Terrain::ANY_TERRAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
TTerrainId CCreature::getNativeTerrain() const
|
TerrainId CCreature::getNativeTerrain() const
|
||||||
{
|
{
|
||||||
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY";
|
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY";
|
||||||
static const auto selectorNoTerrainPenalty = Selector::type()(Bonus::NO_TERRAIN_PENALTY);
|
static const auto selectorNoTerrainPenalty = Selector::type()(Bonus::NO_TERRAIN_PENALTY);
|
||||||
|
@ -121,14 +121,14 @@ public:
|
|||||||
|
|
||||||
ArtifactID warMachine;
|
ArtifactID warMachine;
|
||||||
|
|
||||||
bool isItNativeTerrain(TTerrainId terrain) const;
|
bool isItNativeTerrain(TerrainId terrain) const;
|
||||||
/**
|
/**
|
||||||
Returns creature native terrain considering some terrain bonuses.
|
Returns creature native terrain considering some terrain bonuses.
|
||||||
@param considerBonus is used to avoid Dead Lock when this method is called inside getAllBonuses
|
@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 = 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.
|
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 getIndex() const override;
|
||||||
int32_t getIconIndex() const override;
|
int32_t getIconIndex() const override;
|
||||||
const std::string & getName() const override;
|
const std::string & getName() const override;
|
||||||
|
@ -124,7 +124,7 @@ public:
|
|||||||
std::vector<std::string> advobtxt;
|
std::vector<std::string> advobtxt;
|
||||||
std::vector<std::string> xtrainfo;
|
std::vector<std::string> xtrainfo;
|
||||||
std::vector<std::string> restypes; //names of resources
|
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::string> randsign;
|
||||||
std::vector<std::pair<std::string,std::string>> mines; //first - name; second - event description
|
std::vector<std::pair<std::string,std::string>> mines; //first - name; second - event description
|
||||||
std::vector<std::string> seerEmpty;
|
std::vector<std::string> seerEmpty;
|
||||||
|
@ -266,7 +266,7 @@ public:
|
|||||||
CHeroClassHandler classes;
|
CHeroClassHandler classes;
|
||||||
|
|
||||||
//default costs of going through terrains. -1 means terrain is impassable
|
//default costs of going through terrains. -1 means terrain is impassable
|
||||||
std::map<TTerrainId, int> terrCosts;
|
std::map<TerrainId, int> terrCosts;
|
||||||
|
|
||||||
struct SBallisticsLevelInfo
|
struct SBallisticsLevelInfo
|
||||||
{
|
{
|
||||||
|
@ -529,7 +529,7 @@ struct DLL_LINKAGE TurnInfo
|
|||||||
TConstBonusListPtr bonuses;
|
TConstBonusListPtr bonuses;
|
||||||
mutable int maxMovePointsLand;
|
mutable int maxMovePointsLand;
|
||||||
mutable int maxMovePointsWater;
|
mutable int maxMovePointsWater;
|
||||||
TTerrainId nativeTerrain;
|
TerrainId nativeTerrain;
|
||||||
|
|
||||||
TurnInfo(const CGHeroInstance * Hero, const int Turn = 0);
|
TurnInfo(const CGHeroInstance * Hero, const int Turn = 0);
|
||||||
bool isLayerAvailable(const EPathfindingLayer layer) const;
|
bool isLayerAvailable(const EPathfindingLayer layer) const;
|
||||||
|
@ -334,7 +334,7 @@ bool CStack::isOnNativeTerrain() const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStack::isOnTerrain(TTerrainId terrain) const
|
bool CStack::isOnTerrain(TerrainId terrain) const
|
||||||
{
|
{
|
||||||
return battle->getTerrainType() == terrain;
|
return battle->getTerrainType() == terrain;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
ui32 ID; //unique ID of stack
|
ui32 ID; //unique ID of stack
|
||||||
const CCreature * type;
|
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;
|
ui32 baseAmount;
|
||||||
|
|
||||||
PlayerColor owner; //owner - player color (255 for neutrals)
|
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 canBeHealed() const; //for first aid tent - only harmed stacks that are not war machines
|
||||||
bool isOnNativeTerrain() const;
|
bool isOnNativeTerrain() const;
|
||||||
bool isOnTerrain(TTerrainId terrain) const;
|
bool isOnTerrain(TerrainId terrain) const;
|
||||||
|
|
||||||
ui32 level() const;
|
ui32 level() const;
|
||||||
si32 magicResistance() const override; //include aura of resistance
|
si32 magicResistance() const override; //include aura of resistance
|
||||||
|
@ -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 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 TerrainId CTownHandler::defaultGoodTerrain(Terrain::GRASS);
|
||||||
const TTerrainId CTownHandler::defaultEvilTerrain(Terrain::LAVA);
|
const TerrainId CTownHandler::defaultEvilTerrain(Terrain::LAVA);
|
||||||
const TTerrainId CTownHandler::defaultNeutralTerrain(Terrain::ROUGH);
|
const TerrainId CTownHandler::defaultNeutralTerrain(Terrain::ROUGH);
|
||||||
|
|
||||||
const std::map<std::string, CBuilding::EBuildMode> CBuilding::MODES =
|
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);
|
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)
|
switch(alignment)
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,7 @@ public:
|
|||||||
|
|
||||||
TFaction index;
|
TFaction index;
|
||||||
|
|
||||||
TTerrainId nativeTerrain;
|
TerrainId nativeTerrain;
|
||||||
EAlignment::EAlignment alignment;
|
EAlignment::EAlignment alignment;
|
||||||
bool preferUndergroundPlacement;
|
bool preferUndergroundPlacement;
|
||||||
|
|
||||||
@ -360,9 +360,9 @@ class DLL_LINKAGE CTownHandler : public CHandlerBase<FactionID, Faction, CFactio
|
|||||||
std::vector<BuildingRequirementsHelper> requirementsToLoad;
|
std::vector<BuildingRequirementsHelper> requirementsToLoad;
|
||||||
std::vector<BuildingRequirementsHelper> overriddenBidsToLoad; //list of buildings, which bonuses should be overridden.
|
std::vector<BuildingRequirementsHelper> overriddenBidsToLoad; //list of buildings, which bonuses should be overridden.
|
||||||
|
|
||||||
const static TTerrainId defaultGoodTerrain;
|
const static TerrainId defaultGoodTerrain;
|
||||||
const static TTerrainId defaultEvilTerrain;
|
const static TerrainId defaultEvilTerrain;
|
||||||
const static TTerrainId defaultNeutralTerrain;
|
const static TerrainId defaultNeutralTerrain;
|
||||||
|
|
||||||
static TPropagatorPtr & emptyPropagator();
|
static TPropagatorPtr & emptyPropagator();
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ class DLL_LINKAGE CTownHandler : public CHandlerBase<FactionID, Faction, CFactio
|
|||||||
|
|
||||||
void loadPuzzle(CFaction & faction, const JsonNode & source);
|
void loadPuzzle(CFaction & faction, const JsonNode & source);
|
||||||
|
|
||||||
TTerrainId getDefaultTerrainForAlignment(EAlignment::EAlignment aligment) const;
|
TerrainId getDefaultTerrainForAlignment(EAlignment::EAlignment aligment) const;
|
||||||
void loadRandomFaction();
|
void loadRandomFaction();
|
||||||
|
|
||||||
|
|
||||||
|
@ -1234,9 +1234,9 @@ typedef si64 TExpType;
|
|||||||
typedef std::pair<si64, si64> TDmgRange;
|
typedef std::pair<si64, si64> TDmgRange;
|
||||||
typedef si32 TBonusSubtype;
|
typedef si32 TBonusSubtype;
|
||||||
typedef si32 TQuantity;
|
typedef si32 TQuantity;
|
||||||
typedef si8 TTerrainId;
|
typedef si8 TerrainId;
|
||||||
typedef si8 TRoadId;
|
typedef si8 RoadId;
|
||||||
typedef si8 TRiverId;
|
typedef si8 RiverId;
|
||||||
|
|
||||||
typedef int TRmgTemplateZoneId;
|
typedef int TRmgTemplateZoneId;
|
||||||
|
|
||||||
|
@ -2113,7 +2113,7 @@ CreatureTerrainLimiter::CreatureTerrainLimiter()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatureTerrainLimiter::CreatureTerrainLimiter(TTerrainId terrain):
|
CreatureTerrainLimiter::CreatureTerrainLimiter(TerrainId terrain):
|
||||||
terrainType(terrain)
|
terrainType(terrain)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1062,9 +1062,9 @@ public:
|
|||||||
class DLL_LINKAGE CreatureTerrainLimiter : public ILimiter //applies only to creatures that are on specified terrain, default native terrain
|
class DLL_LINKAGE CreatureTerrainLimiter : public ILimiter //applies only to creatures that are on specified terrain, default native terrain
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TTerrainId terrainType;
|
TerrainId terrainType;
|
||||||
CreatureTerrainLimiter();
|
CreatureTerrainLimiter();
|
||||||
CreatureTerrainLimiter(TTerrainId terrain);
|
CreatureTerrainLimiter(TerrainId terrain);
|
||||||
|
|
||||||
int limit(const BonusLimitationContext &context) const override;
|
int limit(const BonusLimitationContext &context) const override;
|
||||||
virtual std::string toString() const override;
|
virtual std::string toString() const override;
|
||||||
|
@ -703,7 +703,7 @@ DLL_LINKAGE void GiveHero::applyGs(CGameState *gs)
|
|||||||
|
|
||||||
DLL_LINKAGE void NewObject::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
|
if(ID == Obj::BOAT && !gs->isInTheMap(pos)) //special handling for bug #3060 - pos outside map but visitablePos is not
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ std::vector<BattleHex> ObstacleInfo::getBlocked(BattleHex hex) const
|
|||||||
return ret;
|
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();
|
auto bgInfo = battlefield.getInfo();
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
si32 iconIndex;
|
si32 iconIndex;
|
||||||
std::string identifier;
|
std::string identifier;
|
||||||
std::string appearAnimation, animation, dissapearAnimation;
|
std::string appearAnimation, animation, dissapearAnimation;
|
||||||
std::vector<TTerrainId> allowedTerrains;
|
std::vector<TerrainId> allowedTerrains;
|
||||||
std::vector<std::string> allowedSpecialBfields;
|
std::vector<std::string> allowedSpecialBfields;
|
||||||
|
|
||||||
//TODO: here is extra field to implement it's logic in the future but save backward compatibility
|
//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'
|
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)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
|
@ -149,16 +149,16 @@ void TerrainTypeHandler::initTerrains(const std::vector<std::string> & allConfig
|
|||||||
if(!terr.second["originalTerrainId"].isNull())
|
if(!terr.second["originalTerrainId"].isNull())
|
||||||
{
|
{
|
||||||
//place in reserved slot
|
//place in reserved slot
|
||||||
info.id = (TTerrainId)(terr.second["originalTerrainId"].Float());
|
info.id = (TerrainId)(terr.second["originalTerrainId"].Float());
|
||||||
objects[info.id] = info;
|
objects[info.id] = info;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//append at the end
|
//append at the end
|
||||||
info.id = static_cast<TTerrainId>(objects.size());
|
info.id = static_cast<TerrainId>(objects.size());
|
||||||
objects.push_back(info);
|
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
|
//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())
|
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;
|
riverTypes[info.id] = info;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info.id = static_cast<TRiverId>(riverTypes.size());
|
info.id = static_cast<RiverId>(riverTypes.size());
|
||||||
riverTypes.push_back(info);
|
riverTypes.push_back(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,12 +261,12 @@ void TerrainTypeHandler::initRoads(const std::vector<std::string> & allConfigs)
|
|||||||
|
|
||||||
if (!road.second["originalRoadId"].isNull())
|
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;
|
roadTypes[info.id] = info;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info.id = static_cast<TRoadId>(roadTypes.size());
|
info.id = static_cast<RoadId>(roadTypes.size());
|
||||||
roadTypes.push_back(info);
|
roadTypes.push_back(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ const TerrainType* TerrainTypeHandler::getInfoByCode(const std::string& terrainC
|
|||||||
return terrainInfoByCode.at(terrainCode);
|
return terrainInfoByCode.at(terrainCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TerrainType* TerrainTypeHandler::getInfoById(TTerrainId id) const
|
const TerrainType* TerrainTypeHandler::getInfoById(TerrainId id) const
|
||||||
{
|
{
|
||||||
return terrainInfoById.at(id);
|
return terrainInfoById.at(id);
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ const RiverType* TerrainTypeHandler::getRiverByCode(const std::string& riverCode
|
|||||||
return riverInfoByCode.at(riverCode);
|
return riverInfoByCode.at(riverCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RiverType* TerrainTypeHandler::getRiverById(TRiverId id) const
|
const RiverType* TerrainTypeHandler::getRiverById(RiverId id) const
|
||||||
{
|
{
|
||||||
return riverInfoById.at(id);
|
return riverInfoById.at(id);
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ const RoadType* TerrainTypeHandler::getRoadByCode(const std::string& roadCode) c
|
|||||||
return roadInfoByCode.at(roadCode);
|
return roadInfoByCode.at(roadCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RoadType* TerrainTypeHandler::getRoadById(TRoadId id) const
|
const RoadType* TerrainTypeHandler::getRoadById(RoadId id) const
|
||||||
{
|
{
|
||||||
return roadInfoById.at(id);
|
return roadInfoById.at(id);
|
||||||
}
|
}
|
||||||
@ -467,7 +467,7 @@ bool TerrainType::isTransitionRequired() const
|
|||||||
return transitionRequired;
|
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),
|
fileName(fileName),
|
||||||
code(code),
|
code(code),
|
||||||
id(id)
|
id(id)
|
||||||
@ -484,7 +484,7 @@ RiverType& RiverType::operator=(const RiverType& other)
|
|||||||
return *this;
|
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),
|
fileName(fileName),
|
||||||
code(code),
|
code(code),
|
||||||
id(id),
|
id(id),
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::string> battleFields;
|
std::vector<std::string> battleFields;
|
||||||
std::vector<TTerrainId> prohibitTransitions;
|
std::vector<TerrainId> prohibitTransitions;
|
||||||
std::array<int, 3> minimapBlocked;
|
std::array<int, 3> minimapBlocked;
|
||||||
std::array<int, 3> minimapUnblocked;
|
std::array<int, 3> minimapUnblocked;
|
||||||
std::string name;
|
std::string name;
|
||||||
@ -39,10 +39,10 @@ public:
|
|||||||
std::string terrainText;
|
std::string terrainText;
|
||||||
std::string typeCode;
|
std::string typeCode;
|
||||||
std::string terrainViewPatterns;
|
std::string terrainViewPatterns;
|
||||||
TRiverId river;
|
RiverId river;
|
||||||
|
|
||||||
TTerrainId id;
|
TerrainId id;
|
||||||
TTerrainId rockTerrain;
|
TerrainId rockTerrain;
|
||||||
int moveCost;
|
int moveCost;
|
||||||
int horseSoundId;
|
int horseSoundId;
|
||||||
ui8 passabilityType;
|
ui8 passabilityType;
|
||||||
@ -95,9 +95,9 @@ public:
|
|||||||
std::string fileName;
|
std::string fileName;
|
||||||
std::string code;
|
std::string code;
|
||||||
std::string deltaName;
|
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);
|
RiverType& operator=(const RiverType & other);
|
||||||
|
|
||||||
@ -115,10 +115,10 @@ class DLL_LINKAGE RoadType
|
|||||||
public:
|
public:
|
||||||
std::string fileName;
|
std::string fileName;
|
||||||
std::string code;
|
std::string code;
|
||||||
TRoadId id;
|
RoadId id;
|
||||||
ui8 movementCost;
|
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);
|
RoadType& operator=(const RoadType & other);
|
||||||
|
|
||||||
@ -143,17 +143,17 @@ public:
|
|||||||
const std::vector<TerrainType> & terrains() const;
|
const std::vector<TerrainType> & terrains() const;
|
||||||
const TerrainType * getInfoByName(const std::string & terrainName) const;
|
const TerrainType * getInfoByName(const std::string & terrainName) const;
|
||||||
const TerrainType * getInfoByCode(const std::string & terrainCode) 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 std::vector<RiverType> & rivers() const;
|
||||||
const RiverType * getRiverByName(const std::string & riverName) const;
|
const RiverType * getRiverByName(const std::string & riverName) const;
|
||||||
const RiverType * getRiverByCode(const std::string & riverCode) 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 std::vector<RoadType> & roads() const;
|
||||||
const RoadType * getRoadByName(const std::string & roadName) const;
|
const RoadType * getRoadByName(const std::string & roadName) const;
|
||||||
const RoadType * getRoadByCode(const std::string & roadCode) 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)
|
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*> terrainInfoByName;
|
||||||
std::unordered_map<std::string, const TerrainType*> terrainInfoByCode;
|
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*> riverInfoByName;
|
||||||
std::unordered_map<std::string, const RiverType*> riverInfoByCode;
|
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*> roadInfoByName;
|
||||||
std::unordered_map<std::string, const RoadType*> roadInfoByCode;
|
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 initTerrains(const std::vector<std::string> & allConfigs);
|
||||||
void initRivers(const std::vector<std::string> & allConfigs);
|
void initRivers(const std::vector<std::string> & allConfigs);
|
||||||
|
@ -191,7 +191,7 @@ struct RangeGenerator
|
|||||||
std::function<int()> myRand;
|
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;
|
CMP_stack cmpst;
|
||||||
auto curB = new BattleInfo();
|
auto curB = new BattleInfo();
|
||||||
@ -565,7 +565,7 @@ BattleField BattleInfo::getBattlefieldType() const
|
|||||||
return battlefieldType;
|
return battlefieldType;
|
||||||
}
|
}
|
||||||
|
|
||||||
TTerrainId BattleInfo::getTerrainType() const
|
TerrainId BattleInfo::getTerrainType() const
|
||||||
{
|
{
|
||||||
return terrainType;
|
return terrainType;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
SiegeInfo si;
|
SiegeInfo si;
|
||||||
|
|
||||||
BattleField battlefieldType; //like !!BA:B
|
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 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)
|
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;
|
battle::Units getUnitsIf(battle::UnitFilter predicate) const override;
|
||||||
|
|
||||||
BattleField getBattlefieldType() const override;
|
BattleField getBattlefieldType() const override;
|
||||||
TTerrainId getTerrainType() const override;
|
TerrainId getTerrainType() const override;
|
||||||
|
|
||||||
ObstacleCList getAllObstacles() 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
|
const CGHeroInstance * getHero(PlayerColor player) const; //returns fighting hero that belongs to given player
|
||||||
|
|
||||||
void localInit();
|
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;
|
ui8 whatSide(PlayerColor player) const;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ BattleField BattleProxy::getBattlefieldType() const
|
|||||||
return subject->battleGetBattlefieldType();
|
return subject->battleGetBattlefieldType();
|
||||||
}
|
}
|
||||||
|
|
||||||
TTerrainId BattleProxy::getTerrainType() const
|
TerrainId BattleProxy::getTerrainType() const
|
||||||
{
|
{
|
||||||
return subject->battleTerrainType();
|
return subject->battleTerrainType();
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
battle::Units getUnitsIf(battle::UnitFilter predicate) const override;
|
battle::Units getUnitsIf(battle::UnitFilter predicate) const override;
|
||||||
|
|
||||||
BattleField getBattlefieldType() const override;
|
BattleField getBattlefieldType() const override;
|
||||||
TTerrainId getTerrainType() const override;
|
TerrainId getTerrainType() const override;
|
||||||
|
|
||||||
ObstacleCList getAllObstacles() const override;
|
ObstacleCList getAllObstacles() const override;
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
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();
|
return getBattle()->getTerrainType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
BattlePerspective::BattlePerspective battleGetMySide() const;
|
BattlePerspective::BattlePerspective battleGetMySide() const;
|
||||||
const IBonusBearer * getBattleNode() const;
|
const IBonusBearer * getBattleNode() const;
|
||||||
|
|
||||||
TTerrainId battleTerrainType() const override;
|
TerrainId battleTerrainType() const override;
|
||||||
BattleField battleGetBattlefieldType() const override;
|
BattleField battleGetBattlefieldType() const override;
|
||||||
int32_t battleGetEnchanterCounter(ui8 side) const;
|
int32_t battleGetEnchanterCounter(ui8 side) const;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual scripting::Pool * getContextPool() const = 0;
|
virtual scripting::Pool * getContextPool() const = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual TTerrainId battleTerrainType() const = 0;
|
virtual TerrainId battleTerrainType() const = 0;
|
||||||
virtual BattleField battleGetBattlefieldType() 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
|
///return none if battle is ongoing; otherwise the victorious side (0/1) or 2 if it is a draw
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
virtual battle::Units getUnitsIf(battle::UnitFilter predicate) const = 0;
|
virtual battle::Units getUnitsIf(battle::UnitFilter predicate) const = 0;
|
||||||
|
|
||||||
virtual BattleField getBattlefieldType() const = 0;
|
virtual BattleField getBattlefieldType() const = 0;
|
||||||
virtual TTerrainId getTerrainType() const = 0;
|
virtual TerrainId getTerrainType() const = 0;
|
||||||
|
|
||||||
virtual ObstacleCList getAllObstacles() const = 0;
|
virtual ObstacleCList getAllObstacles() const = 0;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ ui32 CGHeroInstance::getTileCost(const TerrainTile & dest, const TerrainTile & f
|
|||||||
return (ui32)ret;
|
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.
|
// 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.
|
// 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
|
// 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?
|
// TODO: What should we do if all hero stacks are neutral creatures?
|
||||||
TTerrainId nativeTerrain = Terrain::BORDER;
|
TerrainId nativeTerrain = Terrain::BORDER;
|
||||||
|
|
||||||
for(auto stack : stacks)
|
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?
|
if(stackNativeTerrain == Terrain::BORDER) //where does this value come from?
|
||||||
continue;
|
continue;
|
||||||
|
@ -157,7 +157,7 @@ public:
|
|||||||
bool needsLastStack()const override;
|
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
|
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;
|
ui32 getLowestCreatureSpeed() const;
|
||||||
int3 getPosition(bool h3m = false) const; //h3m=true - returns position of hero object; h3m=false - returns position of hero 'manifestation'
|
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
|
si32 manaRegain() const; //how many points of mana can hero regain "naturally" in one day
|
||||||
|
@ -590,7 +590,7 @@ BattleField AObjectTypeHandler::getBattlefield() const
|
|||||||
return battlefield ? BattleField::fromString(battlefield.get()) : BattleField::NONE;
|
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>> templates = getTemplates();
|
||||||
std::vector<std::shared_ptr<const ObjectTemplate>> filtered;
|
std::vector<std::shared_ptr<const ObjectTemplate>> filtered;
|
||||||
@ -607,7 +607,7 @@ std::vector<std::shared_ptr<const ObjectTemplate>>AObjectTypeHandler::getTemplat
|
|||||||
return filtered;
|
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);
|
std::vector<std::shared_ptr<const ObjectTemplate>> ret = getTemplates(terrainType);
|
||||||
for (const auto & tmpl: ret)
|
for (const auto & tmpl: ret)
|
||||||
|
@ -184,11 +184,11 @@ public:
|
|||||||
|
|
||||||
/// returns all templates matching parameters
|
/// returns all templates matching parameters
|
||||||
std::vector<std::shared_ptr<const ObjectTemplate>> getTemplates() const;
|
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)
|
/// 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)
|
/// 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;
|
BattleField getBattlefield() const;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void ObjectTemplate::readTxt(CLegacyConfigParser & parser)
|
|||||||
std::string & terrStr = strings[4]; // allowed terrains, 1 = object can be placed on this terrain
|
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
|
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')
|
if (terrStr[8-i] == '1')
|
||||||
allowedTerrains.insert(i);
|
allowedTerrains.insert(i);
|
||||||
@ -557,7 +557,7 @@ void ObjectTemplate::calculateVisitableOffset()
|
|||||||
visitableOffset = int3(0, 0, 0);
|
visitableOffset = int3(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectTemplate::canBePlacedAt(TTerrainId terrain) const
|
bool ObjectTemplate::canBePlacedAt(TerrainId terrain) const
|
||||||
{
|
{
|
||||||
return vstd::contains(allowedTerrains, terrain);
|
return vstd::contains(allowedTerrains, terrain);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
/// directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
|
||||||
ui8 visitDir;
|
ui8 visitDir;
|
||||||
/// list of terrains on which this object can be placed
|
/// list of terrains on which this object can be placed
|
||||||
std::set<TTerrainId> allowedTerrains;
|
std::set<TerrainId> allowedTerrains;
|
||||||
|
|
||||||
void afterLoadFixup();
|
void afterLoadFixup();
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Checks if object can be placed on specific terrain
|
// Checks if object can be placed on specific terrain
|
||||||
bool canBePlacedAt(TTerrainId terrain) const;
|
bool canBePlacedAt(TerrainId terrain) const;
|
||||||
|
|
||||||
ObjectTemplate();
|
ObjectTemplate();
|
||||||
//custom copy constructor is required
|
//custom copy constructor is required
|
||||||
|
@ -158,14 +158,14 @@ CDrawLinesOperation::CDrawLinesOperation(CMap * map, const CTerrainSelection & t
|
|||||||
}
|
}
|
||||||
|
|
||||||
///CDrawRoadsOperation
|
///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),
|
CDrawLinesOperation(map, terrainSel,gen),
|
||||||
roadType(roadType)
|
roadType(roadType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
///CDrawRiversOperation
|
///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),
|
CDrawLinesOperation(map, terrainSel, gen),
|
||||||
riverType(riverType)
|
riverType(riverType)
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ protected:
|
|||||||
class CDrawRoadsOperation : public CDrawLinesOperation
|
class CDrawRoadsOperation : public CDrawLinesOperation
|
||||||
{
|
{
|
||||||
public:
|
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;
|
std::string getLabel() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -74,13 +74,13 @@ protected:
|
|||||||
void updateTile(TerrainTile & tile, const CDrawLinesOperation::LinePattern & pattern, const int flip) override;
|
void updateTile(TerrainTile & tile, const CDrawLinesOperation::LinePattern & pattern, const int flip) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TRoadId roadType;
|
RoadId roadType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CDrawRiversOperation : public CDrawLinesOperation
|
class CDrawRiversOperation : public CDrawLinesOperation
|
||||||
{
|
{
|
||||||
public:
|
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;
|
std::string getLabel() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -91,7 +91,7 @@ protected:
|
|||||||
void updateTile(TerrainTile & tile, const CDrawLinesOperation::LinePattern & pattern, const int flip) override;
|
void updateTile(TerrainTile & tile, const CDrawLinesOperation::LinePattern & pattern, const int flip) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TRiverId riverType;
|
RiverId riverType;
|
||||||
};
|
};
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
@ -126,19 +126,19 @@ void CMapEditManager::clearTerrain(CRandomGenerator * gen)
|
|||||||
execute(make_unique<CClearTerrainOperation>(map, gen ? gen : &(this->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)));
|
execute(make_unique<CDrawTerrainOperation>(map, terrainSel, terType, gen ? gen : &(this->gen)));
|
||||||
terrainSel.clearSelection();
|
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)));
|
execute(make_unique<CDrawRoadsOperation>(map, terrainSel, roadType, gen ? gen : &(this->gen)));
|
||||||
terrainSel.clearSelection();
|
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)));
|
execute(make_unique<CDrawRiversOperation>(map, terrainSel, riverType, gen ? gen : &(this->gen)));
|
||||||
terrainSel.clearSelection();
|
terrainSel.clearSelection();
|
||||||
|
@ -72,13 +72,13 @@ public:
|
|||||||
void clearTerrain(CRandomGenerator * gen = nullptr);
|
void clearTerrain(CRandomGenerator * gen = nullptr);
|
||||||
|
|
||||||
/// Draws terrain at the current terrain selection. The selection will be cleared automatically.
|
/// 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.
|
/// 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.
|
/// 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 insertObject(CGObjectInstance * obj);
|
||||||
void insertObjects(std::set<CGObjectInstance *> & objects);
|
void insertObjects(std::set<CGObjectInstance *> & objects);
|
||||||
|
@ -83,7 +83,7 @@ void CComposedOperation::addOperation(std::unique_ptr<CMapOperation>&& operation
|
|||||||
operations.push_back(std::move(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),
|
CMapOperation(map),
|
||||||
terrainSel(terrainSel),
|
terrainSel(terrainSel),
|
||||||
terType(terType),
|
terType(terType),
|
||||||
|
@ -63,7 +63,7 @@ private:
|
|||||||
class CDrawTerrainOperation : public CMapOperation
|
class CDrawTerrainOperation : public CMapOperation
|
||||||
{
|
{
|
||||||
public:
|
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 execute() override;
|
||||||
void undo() override;
|
void undo() override;
|
||||||
@ -100,7 +100,7 @@ private:
|
|||||||
ValidationResult validateTerrainViewInner(const int3 & pos, const TerrainViewPattern & pattern, int recDepth = 0) const;
|
ValidationResult validateTerrainViewInner(const int3 & pos, const TerrainViewPattern & pattern, int recDepth = 0) const;
|
||||||
|
|
||||||
CTerrainSelection terrainSel;
|
CTerrainSelection terrainSel;
|
||||||
TTerrainId terType;
|
TerrainId terType;
|
||||||
CRandomGenerator* gen;
|
CRandomGenerator* gen;
|
||||||
std::set<int3> invalidatedTerViews;
|
std::set<int3> invalidatedTerViews;
|
||||||
};
|
};
|
||||||
|
@ -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);
|
auto iter = terrainViewPatterns.find(VLC->terrainTypeHandler->terrains()[terrain].terrainViewPatterns);
|
||||||
if (iter == terrainViewPatterns.end())
|
if (iter == terrainViewPatterns.end())
|
||||||
@ -295,7 +295,7 @@ boost::optional<const TerrainViewPattern &> CTerrainViewPatternConfig::getTerrai
|
|||||||
return boost::optional<const TerrainViewPattern&>();
|
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);
|
const std::vector<TVPVector> & groupPatterns = getTerrainViewPatterns(terrain);
|
||||||
for (const TVPVector & patternFlips : groupPatterns)
|
for (const TVPVector & patternFlips : groupPatterns)
|
||||||
|
@ -217,9 +217,9 @@ public:
|
|||||||
CTerrainViewPatternConfig();
|
CTerrainViewPatternConfig();
|
||||||
~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 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;
|
const TVPVector * getTerrainTypePatternById(const std::string & id) const;
|
||||||
void flipPattern(TerrainViewPattern & pattern, int flip) const;
|
void flipPattern(TerrainViewPattern & pattern, int flip) const;
|
||||||
|
|
||||||
|
@ -217,12 +217,12 @@ boost::optional<int> ZoneOptions::getOwner() const
|
|||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::set<TTerrainId> & ZoneOptions::getTerrainTypes() const
|
const std::set<TerrainId> & ZoneOptions::getTerrainTypes() const
|
||||||
{
|
{
|
||||||
return terrainTypes;
|
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() &&
|
//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());
|
// value.find(ETerrainType::WATER) == value.end() && value.find(ETerrainType::ROCK) == value.end());
|
||||||
|
@ -105,8 +105,8 @@ public:
|
|||||||
void setSize(int value);
|
void setSize(int value);
|
||||||
boost::optional<int> getOwner() const;
|
boost::optional<int> getOwner() const;
|
||||||
|
|
||||||
const std::set<TTerrainId> & getTerrainTypes() const;
|
const std::set<TerrainId> & getTerrainTypes() const;
|
||||||
void setTerrainTypes(const std::set<TTerrainId> & value);
|
void setTerrainTypes(const std::set<TerrainId> & value);
|
||||||
|
|
||||||
const CTownInfo & getPlayerTowns() const;
|
const CTownInfo & getPlayerTowns() const;
|
||||||
const CTownInfo & getNeutralTowns() const;
|
const CTownInfo & getNeutralTowns() const;
|
||||||
@ -146,7 +146,7 @@ protected:
|
|||||||
CTownInfo playerTowns;
|
CTownInfo playerTowns;
|
||||||
CTownInfo neutralTowns;
|
CTownInfo neutralTowns;
|
||||||
bool matchTerrainToTown;
|
bool matchTerrainToTown;
|
||||||
std::set<TTerrainId> terrainTypes;
|
std::set<TerrainId> terrainTypes;
|
||||||
bool townsAreSameType;
|
bool townsAreSameType;
|
||||||
|
|
||||||
std::set<TFaction> townTypes;
|
std::set<TFaction> townTypes;
|
||||||
|
@ -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();
|
auto v = zone.getArea().getTilesVector();
|
||||||
map.getEditManager()->getTerrainSelection().setSelection(v);
|
map.getEditManager()->getTerrainSelection().setSelection(v);
|
||||||
map.getEditManager()->drawTerrain(terrain, &generator);
|
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);
|
auto factories = VLC->objtypeh->knownSubObjects(ObjID);
|
||||||
vstd::erase_if(factories, [ObjID, &terrain](si32 f)
|
vstd::erase_if(factories, [ObjID, &terrain](si32 f)
|
||||||
@ -118,7 +118,7 @@ void initTerrainType(Zone & zone, CMapGenerator & gen)
|
|||||||
if(zone.getType()==ETemplateZoneType::WATER)
|
if(zone.getType()==ETemplateZoneType::WATER)
|
||||||
{
|
{
|
||||||
//collect all water terrain types
|
//collect all water terrain types
|
||||||
std::vector<TTerrainId> waterTerrains;
|
std::vector<TerrainId> waterTerrains;
|
||||||
for(const auto & terrain : VLC->terrainTypeHandler->terrains())
|
for(const auto & terrain : VLC->terrainTypeHandler->terrains())
|
||||||
if(terrain.isWater())
|
if(terrain.isWater())
|
||||||
waterTerrains.push_back(terrain.id);
|
waterTerrains.push_back(terrain.id);
|
||||||
|
@ -42,11 +42,11 @@ rmg::Tileset collectDistantTiles(const Zone & zone, int distance);
|
|||||||
|
|
||||||
void createBorder(RmgMap & gen, Zone & zone);
|
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);
|
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
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
void ObstacleProxy::collectPossibleObstacles(TTerrainId terrain)
|
void ObstacleProxy::collectPossibleObstacles(TerrainId terrain)
|
||||||
{
|
{
|
||||||
//get all possible obstacles for this terrain
|
//get all possible obstacles for this terrain
|
||||||
for(auto primaryID : VLC->objtypeh->knownObjects())
|
for(auto primaryID : VLC->objtypeh->knownObjects())
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
rmg::Area blockedArea;
|
rmg::Area blockedArea;
|
||||||
|
|
||||||
void collectPossibleObstacles(TTerrainId terrain);
|
void collectPossibleObstacles(TerrainId terrain);
|
||||||
|
|
||||||
void placeObstacles(CMap * map, CRandomGenerator & rand);
|
void placeObstacles(CMap * map, CRandomGenerator & rand);
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ void RmgMap::setOccupied(const int3 &tile, ETileType::ETileType state)
|
|||||||
tiles[tile.x][tile.y][tile.z].setOccupied(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);
|
assertOnMap(tile);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
bool isOnMap(const int3 & tile) const;
|
bool isOnMap(const int3 & tile) const;
|
||||||
|
|
||||||
void setOccupied(const int3 &tile, ETileType::ETileType state);
|
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;
|
TileInfo getTile(const int3 & tile) const;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ void Object::Instance::setPositionRaw(const int3 & position)
|
|||||||
dObject.pos = dPosition + dParent.getPosition();
|
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)
|
if(dObject.appearance->id == Obj::NO_OBJ)
|
||||||
{
|
{
|
||||||
@ -259,7 +259,7 @@ void Object::setPosition(const int3 & position)
|
|||||||
i.setPositionRaw(i.getPosition());
|
i.setPositionRaw(i.getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::setTemplate(const TTerrainId & terrain)
|
void Object::setTemplate(const TerrainId & terrain)
|
||||||
{
|
{
|
||||||
for(auto& i : dInstances)
|
for(auto& i : dInstances)
|
||||||
i.setTemplate(terrain);
|
i.setTemplate(terrain);
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
int3 getVisitablePosition() const;
|
int3 getVisitablePosition() const;
|
||||||
bool isVisitableFrom(const int3 & tile) const;
|
bool isVisitableFrom(const int3 & tile) const;
|
||||||
const Area & getAccessibleArea() 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;
|
int3 getPosition(bool isAbsolute = false) const;
|
||||||
void setPosition(const int3 & position); //cache invalidation
|
void setPosition(const int3 & position); //cache invalidation
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
const int3 & getPosition() const;
|
const int3 & getPosition() const;
|
||||||
void setPosition(const int3 & position);
|
void setPosition(const int3 & position);
|
||||||
void setTemplate(const TTerrainId & terrain);
|
void setTemplate(const TerrainId & terrain);
|
||||||
|
|
||||||
const Area & getArea() const; //lazy cache invalidation
|
const Area & getArea() const; //lazy cache invalidation
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ void RoadPlacer::drawRoads(bool secondary)
|
|||||||
zone.freePaths().unite(roads);
|
zone.freePaths().unite(roads);
|
||||||
map.getEditManager()->getTerrainSelection().setSelection(roads.getTilesVector());
|
map.getEditManager()->getTerrainSelection().setSelection(roads.getTilesVector());
|
||||||
std::string roadCode = (secondary ? generator.getConfig().secondaryRoadType : generator.getConfig().defaultRoadType);
|
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);
|
map.getEditManager()->drawRoad(roadType, &generator.rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
rmg::Area rockArea, accessibleArea;
|
rmg::Area rockArea, accessibleArea;
|
||||||
TTerrainId rockTerrain;
|
TerrainId rockTerrain;
|
||||||
};
|
};
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
@ -63,17 +63,17 @@ ETileType::ETileType TileInfo::getTileType() const
|
|||||||
return occupied;
|
return occupied;
|
||||||
}
|
}
|
||||||
|
|
||||||
TTerrainId TileInfo::getTerrainType() const
|
TerrainId TileInfo::getTerrainType() const
|
||||||
{
|
{
|
||||||
return terrain;
|
return terrain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileInfo::setTerrainType(TTerrainId type)
|
void TileInfo::setTerrainType(TerrainId type)
|
||||||
{
|
{
|
||||||
terrain = type;
|
terrain = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileInfo::setRoadType(TRoadId type)
|
void TileInfo::setRoadType(RoadId type)
|
||||||
{
|
{
|
||||||
roadType = type;
|
roadType = type;
|
||||||
// setOccupied(ETileType::FREE);
|
// setOccupied(ETileType::FREE);
|
||||||
|
@ -30,16 +30,16 @@ public:
|
|||||||
bool isUsed() const;
|
bool isUsed() const;
|
||||||
bool isRoad() const;
|
bool isRoad() const;
|
||||||
void setOccupied(ETileType::ETileType value);
|
void setOccupied(ETileType::ETileType value);
|
||||||
TTerrainId getTerrainType() const;
|
TerrainId getTerrainType() const;
|
||||||
ETileType::ETileType getTileType() const;
|
ETileType::ETileType getTileType() const;
|
||||||
void setTerrainType(TTerrainId value);
|
void setTerrainType(TerrainId value);
|
||||||
|
|
||||||
void setRoadType(TRoadId type);
|
void setRoadType(RoadId type);
|
||||||
private:
|
private:
|
||||||
float nearestObjectDistance;
|
float nearestObjectDistance;
|
||||||
ETileType::ETileType occupied;
|
ETileType::ETileType occupied;
|
||||||
TTerrainId terrain;
|
TerrainId terrain;
|
||||||
TRoadId roadType;
|
RoadId roadType;
|
||||||
};
|
};
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
@ -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);
|
auto templHandler = VLC->objtypeh->getHandlerFor(type, subtype);
|
||||||
if(!templHandler)
|
if(!templHandler)
|
||||||
|
@ -28,7 +28,7 @@ struct ObjectInfo
|
|||||||
//ui32 maxPerMap; //unused
|
//ui32 maxPerMap; //unused
|
||||||
std::function<CGObjectInstance *()> generateObject;
|
std::function<CGObjectInstance *()> generateObject;
|
||||||
|
|
||||||
void setTemplate(si32 type, si32 subtype, TTerrainId terrain);
|
void setTemplate(si32 type, si32 subtype, TerrainId terrain);
|
||||||
|
|
||||||
ObjectInfo();
|
ObjectInfo();
|
||||||
|
|
||||||
|
@ -134,12 +134,12 @@ void Zone::setTownType(si32 town)
|
|||||||
townType = town;
|
townType = town;
|
||||||
}
|
}
|
||||||
|
|
||||||
TTerrainId Zone::getTerrainType() const
|
TerrainId Zone::getTerrainType() const
|
||||||
{
|
{
|
||||||
return terrainType;
|
return terrainType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zone::setTerrainType(TTerrainId terrain)
|
void Zone::setTerrainType(TerrainId terrain)
|
||||||
{
|
{
|
||||||
terrainType = terrain;
|
terrainType = terrain;
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,8 @@ public:
|
|||||||
|
|
||||||
si32 getTownType() const;
|
si32 getTownType() const;
|
||||||
void setTownType(si32 town);
|
void setTownType(si32 town);
|
||||||
TTerrainId getTerrainType() const;
|
TerrainId getTerrainType() const;
|
||||||
void setTerrainType(TTerrainId terrain);
|
void setTerrainType(TerrainId terrain);
|
||||||
|
|
||||||
void connectPath(const rmg::Path & path);
|
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;
|
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
|
//template info
|
||||||
si32 townType;
|
si32 townType;
|
||||||
TTerrainId terrainType;
|
TerrainId terrainType;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2241,7 +2241,7 @@ void CGameHandler::setupBattle(int3 tile, const CArmedInstance *armies[2], const
|
|||||||
battleResult.set(nullptr);
|
battleResult.set(nullptr);
|
||||||
|
|
||||||
const auto & t = *getTile(tile);
|
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
|
if (gs->map->isCoastalTile(tile)) //coastal tile is always ground
|
||||||
terrain = Terrain::SAND;
|
terrain = Terrain::SAND;
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ public:
|
|||||||
|
|
||||||
const auto & t = *gameCallback->getTile(tile);
|
const auto & t = *gameCallback->getTile(tile);
|
||||||
|
|
||||||
TTerrainId terrain = t.terType->id;
|
TerrainId terrain = t.terType->id;
|
||||||
BattleField terType = BattleField::fromString("grass_hills");
|
BattleField terType = BattleField::fromString("grass_hills");
|
||||||
|
|
||||||
//send info about battles
|
//send info about battles
|
||||||
|
@ -17,7 +17,7 @@ class IBattleInfoCallbackMock : public IBattleInfoCallback
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MOCK_CONST_METHOD0(getContextPool, scripting::Pool *());
|
MOCK_CONST_METHOD0(getContextPool, scripting::Pool *());
|
||||||
MOCK_CONST_METHOD0(battleTerrainType, TTerrainId());
|
MOCK_CONST_METHOD0(battleTerrainType, TerrainId());
|
||||||
MOCK_CONST_METHOD0(battleGetBattlefieldType, BattleField());
|
MOCK_CONST_METHOD0(battleGetBattlefieldType, BattleField());
|
||||||
|
|
||||||
MOCK_CONST_METHOD0(battleIsFinished, boost::optional<int>());
|
MOCK_CONST_METHOD0(battleIsFinished, boost::optional<int>());
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
MOCK_CONST_METHOD1(getStacksIf, TStacks(TStackFilter));
|
MOCK_CONST_METHOD1(getStacksIf, TStacks(TStackFilter));
|
||||||
MOCK_CONST_METHOD1(getUnitsIf, battle::Units(battle::UnitFilter));
|
MOCK_CONST_METHOD1(getUnitsIf, battle::Units(battle::UnitFilter));
|
||||||
MOCK_CONST_METHOD0(getBattlefieldType, BattleField());
|
MOCK_CONST_METHOD0(getBattlefieldType, BattleField());
|
||||||
MOCK_CONST_METHOD0(getTerrainType, TTerrainId());
|
MOCK_CONST_METHOD0(getTerrainType, TerrainId());
|
||||||
MOCK_CONST_METHOD0(getAllObstacles, IBattleInfo::ObstacleCList());
|
MOCK_CONST_METHOD0(getAllObstacles, IBattleInfo::ObstacleCList());
|
||||||
MOCK_CONST_METHOD0(getDefendedTown, const CGTownInstance *());
|
MOCK_CONST_METHOD0(getDefendedTown, const CGTownInstance *());
|
||||||
MOCK_CONST_METHOD1(getWallState, si8(int));
|
MOCK_CONST_METHOD1(getWallState, si8(int));
|
||||||
|
Loading…
Reference in New Issue
Block a user