std::ostream & operator<<(std::ostream & os, const EPathfindingLayer pathfindingLayer) { static const std::map<EPathfindingLayer::EEPathfindingLayer, std::string> pathfinderLayerToString { #define DEFINE_ELEMENT(element) {EPathfindingLayer::element, #element} DEFINE_ELEMENT(WRONG), DEFINE_ELEMENT(AUTO), DEFINE_ELEMENT(LAND), DEFINE_ELEMENT(SAIL), DEFINE_ELEMENT(WATER), DEFINE_ELEMENT(AIR), DEFINE_ELEMENT(NUM_LAYERS) #undef DEFINE_ELEMENT }; auto it = pathfinderLayerToString.find(pathfindingLayer.num); if (it == pathfinderLayerToString.end()) return os << "<Unknown type>"; else return os << it->second; }
std::ostream & operator<<(std::ostream & os, const ETerrainType actionType) { static const std::map<ETerrainType::EETerrainType, std::string> terrainTypeToString = { #define DEFINE_ELEMENT(element) {ETerrainType::element, #element} DEFINE_ELEMENT(WRONG), DEFINE_ELEMENT(BORDER), DEFINE_ELEMENT(DIRT), DEFINE_ELEMENT(SAND), DEFINE_ELEMENT(GRASS), DEFINE_ELEMENT(SNOW), DEFINE_ELEMENT(SWAMP), DEFINE_ELEMENT(ROUGH), DEFINE_ELEMENT(SUBTERRANEAN), DEFINE_ELEMENT(LAVA), DEFINE_ELEMENT(WATER), DEFINE_ELEMENT(ROCK) }; auto it = terrainTypeToString.find(actionType.num); if (it == terrainTypeToString.end()) return os << "<Unknown type>"; else return os << it->second; }