mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Pass on EPathfindingLayer and small fixes for code around it
This commit is contained in:
parent
5f3e9deda7
commit
9fe442537b
@ -132,7 +132,7 @@ std::ostream & operator<<(std::ostream & os, const Battle::ActionType actionType
|
||||
else return os << it->second;
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, const ETerrainType actionType)
|
||||
std::ostream & operator<<(std::ostream & os, const ETerrainType terrainType)
|
||||
{
|
||||
static const std::map<ETerrainType::EETerrainType, std::string> terrainTypeToString =
|
||||
{
|
||||
@ -149,9 +149,10 @@ std::ostream & operator<<(std::ostream & os, const ETerrainType actionType)
|
||||
DEFINE_ELEMENT(LAVA),
|
||||
DEFINE_ELEMENT(WATER),
|
||||
DEFINE_ELEMENT(ROCK)
|
||||
#undef DEFINE_ELEMENT
|
||||
};
|
||||
|
||||
auto it = terrainTypeToString.find(actionType.num);
|
||||
auto it = terrainTypeToString.find(terrainType.num);
|
||||
if (it == terrainTypeToString.end()) return os << "<Unknown type>";
|
||||
else return os << it->second;
|
||||
}
|
||||
@ -163,9 +164,9 @@ std::string ETerrainType::toString() const
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, const EPathfindingLayer actionType)
|
||||
std::ostream & operator<<(std::ostream & os, const EPathfindingLayer pathfindingLayer)
|
||||
{
|
||||
static const std::map<EPathfindingLayer::EEPathfindingLayer, std::string> pathfinderLayerToString =
|
||||
static const std::map<EPathfindingLayer::EEPathfindingLayer, std::string> pathfinderLayerToString
|
||||
{
|
||||
#define DEFINE_ELEMENT(element) {EPathfindingLayer::element, #element}
|
||||
DEFINE_ELEMENT(WRONG),
|
||||
@ -175,17 +176,10 @@ std::ostream & operator<<(std::ostream & os, const EPathfindingLayer actionType)
|
||||
DEFINE_ELEMENT(WATER),
|
||||
DEFINE_ELEMENT(AIR),
|
||||
DEFINE_ELEMENT(NUM_LAYERS)
|
||||
|
||||
#undef DEFINE_ELEMENT
|
||||
};
|
||||
|
||||
auto it = pathfinderLayerToString.find(actionType.num);
|
||||
auto it = pathfinderLayerToString.find(pathfindingLayer.num);
|
||||
if (it == pathfinderLayerToString.end()) return os << "<Unknown type>";
|
||||
else return os << it->second;
|
||||
}
|
||||
|
||||
std::string EPathfindingLayer::toString() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << *this;
|
||||
return ss.str();
|
||||
}
|
||||
|
@ -741,7 +741,7 @@ public:
|
||||
std::string toString() const;
|
||||
};
|
||||
|
||||
DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const ETerrainType actionType);
|
||||
DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const ETerrainType terrainType);
|
||||
|
||||
ID_LIKE_OPERATORS_DECLS(ETerrainType, ETerrainType::EETerrainType)
|
||||
|
||||
@ -759,11 +759,9 @@ public:
|
||||
ID_LIKE_CLASS_COMMON(EPathfindingLayer, EEPathfindingLayer)
|
||||
|
||||
EEPathfindingLayer num;
|
||||
|
||||
std::string toString() const;
|
||||
};
|
||||
|
||||
DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const EPathfindingLayer actionType);
|
||||
DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const EPathfindingLayer pathfindingLayer);
|
||||
|
||||
ID_LIKE_OPERATORS_DECLS(EPathfindingLayer, EPathfindingLayer::EEPathfindingLayer)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user