Browse Source

Reorganize namespaces

Tomasz Zieliński 2 years ago
parent
commit
3889193a48

+ 4 - 4
lib/rmg/CRmgTemplate.cpp

@@ -439,8 +439,8 @@ ZoneConnection::ZoneConnection():
 	zoneA(-1),
 	zoneB(-1),
 	guardStrength(0),
-	connectionType(EConnectionType::EConnectionType::GUARDED),
-	hasRoad(ERoadOption::ERoadOption::ROAD_TRUE)
+	connectionType(rmg::EConnectionType::GUARDED),
+	hasRoad(rmg::ERoadOption::ROAD_TRUE)
 {
 
 }
@@ -476,12 +476,12 @@ int ZoneConnection::getGuardStrength() const
 	return guardStrength;
 }
 
-EConnectionType::EConnectionType ZoneConnection::getConnectionType() const
+rmg::EConnectionType ZoneConnection::getConnectionType() const
 {
 	return connectionType;
 }
 
-ERoadOption::ERoadOption ZoneConnection::getRoadOption() const
+rmg::ERoadOption ZoneConnection::getRoadOption() const
 {
 	return hasRoad;
 }

+ 16 - 22
lib/rmg/CRmgTemplate.h

@@ -67,29 +67,23 @@ public:
 	void serializeJson(JsonSerializeFormat & handler);
 };
 
-namespace EConnectionType
+namespace rmg
 {
-	enum class EConnectionType
-	{
-		GUARDED = 0, //default
-		FICTIVE,
-		REPULSIVE,
-		WIDE
-	};
-}
 
-namespace ERoadOption
+enum class EConnectionType
 {
-	enum class ERoadOption
-	{
-		ROAD_TRUE,
-		ROAD_FALSE,
-		ROAD_RANDOM
-	};
-}
+	GUARDED = 0, //default
+	FICTIVE,
+	REPULSIVE,
+	WIDE
+};
 
-namespace rmg
+enum class ERoadOption
 {
+	ROAD_TRUE,
+	ROAD_FALSE,
+	ROAD_RANDOM
+};
 
 class DLL_LINKAGE ZoneConnection
 {
@@ -101,8 +95,8 @@ public:
 	TRmgTemplateZoneId getZoneB() const;
 	TRmgTemplateZoneId getOtherZoneId(TRmgTemplateZoneId id) const;
 	int getGuardStrength() const;
-	EConnectionType::EConnectionType getConnectionType() const;
-	ERoadOption::ERoadOption getRoadOption() const;
+	rmg::EConnectionType getConnectionType() const;
+	rmg::ERoadOption getRoadOption() const;
 
 	void serializeJson(JsonSerializeFormat & handler);
 	
@@ -111,8 +105,8 @@ private:
 	TRmgTemplateZoneId zoneA;
 	TRmgTemplateZoneId zoneB;
 	int guardStrength;
-	EConnectionType::EConnectionType connectionType;
-	ERoadOption::ERoadOption hasRoad;
+	rmg::EConnectionType connectionType;
+	rmg::ERoadOption hasRoad;
 };
 
 class DLL_LINKAGE ZoneOptions

+ 5 - 5
lib/rmg/CZonePlacer.cpp

@@ -75,7 +75,7 @@ void CZonePlacer::findPathsBetweenZones()
 
 			for (auto & connection : connectedZoneIds)
 			{
-				if (connection.getConnectionType() == EConnectionType::EConnectionType::REPULSIVE)
+				if (connection.getConnectionType() == rmg::EConnectionType::REPULSIVE)
 				{
 					//Do not consider virtual connections for graph distance
 					continue;
@@ -536,7 +536,7 @@ void CZonePlacer::attractConnectedZones(TZoneMap & zones, TForceVector & forces,
 
 		for (const auto & connection : zone.second->getConnections())
 		{
-			if (connection.getConnectionType() == EConnectionType::EConnectionType::REPULSIVE)
+			if (connection.getConnectionType() == rmg::EConnectionType::REPULSIVE)
 			{
 				continue;
 			}
@@ -625,7 +625,7 @@ void CZonePlacer::separateOverlappingZones(TZoneMap &zones, TForceVector &forces
 		//TODO: Consider z plane?
 		for (auto& connection : zone.second->getConnections())
 		{
-			if (connection.getConnectionType() == EConnectionType::EConnectionType::REPULSIVE)
+			if (connection.getConnectionType() == rmg::EConnectionType::REPULSIVE)
 			{
 				auto & otherZone = zones[connection.getOtherZoneId(zone.second->getId())];
 				float3 otherZoneCenter = otherZone->getCenter();
@@ -693,7 +693,7 @@ void CZonePlacer::moveOneZone(TZoneMap& zones, TForceVector& totalForces, TDista
 		for (const auto& connection : firstZone->getConnections())
 		{
 			//FIXME: Should we also exclude fictive connections?
-			if (connection.getConnectionType() != EConnectionType::EConnectionType::REPULSIVE)
+			if (connection.getConnectionType() != rmg::EConnectionType::REPULSIVE)
 			{
 				connectedZones.insert(connection.getOtherZoneId(firstZone->getId()));
 			}
@@ -740,7 +740,7 @@ void CZonePlacer::moveOneZone(TZoneMap& zones, TForceVector& totalForces, TDista
 		float maxDistance = 0;
 		for (auto con : misplacedZone->getConnections())
 		{
-			if (con.getConnectionType() == EConnectionType::EConnectionType::REPULSIVE)
+			if (con.getConnectionType() == rmg::EConnectionType::REPULSIVE)
 			{
 				continue;
 			}

+ 6 - 6
lib/rmg/modificators/ConnectionsPlacer.cpp

@@ -110,7 +110,7 @@ void ConnectionsPlacer::selfSideDirectConnection(const rmg::ZoneConnection & con
 
 	if (directConnectionIterator != dNeighbourZones.end())
 	{
-		if (connection.getConnectionType() == EConnectionType::EConnectionType::WIDE)
+		if (connection.getConnectionType() == rmg::EConnectionType::WIDE)
 		{
 			for (auto borderPos : directConnectionIterator->second)
 			{
@@ -159,8 +159,8 @@ void ConnectionsPlacer::selfSideDirectConnection(const rmg::ZoneConnection & con
 		}
 	}
 
-	if (connection.getConnectionType() == EConnectionType::EConnectionType::FICTIVE || 
-		connection.getConnectionType() == EConnectionType::EConnectionType::REPULSIVE)
+	if (connection.getConnectionType() == rmg::EConnectionType::FICTIVE || 
+		connection.getConnectionType() == rmg::EConnectionType::REPULSIVE)
 	{
 		//Fictive or repulsive connections are not real, take no action
 		dCompleted.push_back(connection);
@@ -396,8 +396,8 @@ void ConnectionsPlacer::collectNeighbourZones()
 
 bool ConnectionsPlacer::shouldGenerateRoad(const rmg::ZoneConnection& connection) const
 {
-	return connection.getRoadOption() == ERoadOption::ERoadOption::ROAD_TRUE ||
-		(connection.getRoadOption() == ERoadOption::ERoadOption::ROAD_RANDOM && zone.getRand().nextDouble() >= 0.5f);
+	return connection.getRoadOption() == rmg::ERoadOption::ROAD_TRUE ||
+		(connection.getRoadOption() == rmg::ERoadOption::ROAD_RANDOM && zone.getRand().nextDouble() >= 0.5f);
 }
 
 void ConnectionsPlacer::createBorder()
@@ -415,7 +415,7 @@ void ConnectionsPlacer::createBorder()
 	{
 		auto otherZone = connection.getOtherZoneId(zone.getId());
 
-		if (connection.getConnectionType() == EConnectionType::EConnectionType::WIDE)
+		if (connection.getConnectionType() == rmg::EConnectionType::WIDE)
 		{
 			auto sharedBorder = borderArea.getSubarea([this, otherZone, &borderOutsideArea](const int3 & t)
 			{