浏览代码

Fix duplicated offroad connections

Tomasz Zieliński 11 月之前
父节点
当前提交
e5b151991b
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      lib/rmg/modificators/ConnectionsPlacer.cpp

+ 3 - 4
lib/rmg/modificators/ConnectionsPlacer.cpp

@@ -143,7 +143,7 @@ void ConnectionsPlacer::forcePortalConnection(const rmg::ZoneConnection & connec
 void ConnectionsPlacer::selfSideDirectConnection(const rmg::ZoneConnection & connection)
 {
 	bool success = false;
-	auto otherZoneId = (connection.getZoneA() == zone.getId() ? connection.getZoneB() : connection.getZoneA());
+	auto otherZoneId = connection.getOtherZoneId(zone.getId());
 	auto & otherZone = map.getZones().at(otherZoneId);
 	bool createRoad = shouldGenerateRoad(connection);
 	
@@ -327,10 +327,9 @@ void ConnectionsPlacer::selfSideDirectConnection(const rmg::ZoneConnection & con
 
 					assert(otherZone->getModificator<RoadPlacer>());
 					otherZone->getModificator<RoadPlacer>()->addRoadNode(roadNode);
-
-					assert(otherZone->getModificator<ConnectionsPlacer>());
-					otherZone->getModificator<ConnectionsPlacer>()->otherSideConnection(connection);
 				}
+				assert(otherZone->getModificator<ConnectionsPlacer>());
+				otherZone->getModificator<ConnectionsPlacer>()->otherSideConnection(connection);
 
 				success = true;
 			}