Browse Source

Fix broken roads to portals or gates by the lower zone border

Tomasz Zieliński 1 year ago
parent
commit
c8fcc6ffca
4 changed files with 3 additions and 5 deletions
  1. 2 2
      lib/rmg/Functions.cpp
  2. 1 1
      lib/rmg/Functions.h
  3. 0 1
      lib/rmg/Zone.cpp
  4. 0 1
      lib/rmg/modificators/ConnectionsPlacer.cpp

+ 2 - 2
lib/rmg/Functions.cpp

@@ -24,13 +24,13 @@
 
 VCMI_LIB_NAMESPACE_BEGIN
 
-void replaceWithCurvedPath(rmg::Path & path, const Zone & zone, const int3 & src)
+void replaceWithCurvedPath(rmg::Path & path, const Zone & zone, const int3 & src, bool onlyStraight)
 {
 	auto costFunction = rmg::Path::createCurvedCostFunction(zone.area()->getBorder());
 	auto pathArea = zone.areaForRoads();
 	rmg::Path curvedPath(pathArea);
 	curvedPath.connect(zone.freePaths().get());
-	curvedPath = curvedPath.search(src, false, costFunction);
+	curvedPath = curvedPath.search(src, onlyStraight, costFunction);
 	if (curvedPath.valid())
 	{
 		path = curvedPath;

+ 1 - 1
lib/rmg/Functions.h

@@ -34,7 +34,7 @@ public:
 	}
 };
 
-void replaceWithCurvedPath(rmg::Path & path, const Zone & zone, const int3 & src);
+void replaceWithCurvedPath(rmg::Path & path, const Zone & zone, const int3 & src, bool onlyStraight = true);
 
 rmg::Tileset collectDistantTiles(const Zone & zone, int distance);
 

+ 0 - 1
lib/rmg/Zone.cpp

@@ -304,7 +304,6 @@ void Zone::fractalize()
 	logGlobal->trace("Zone %d: treasureValue %d blockDistance: %2.f, freeDistance: %2.f", getId(), treasureValue, blockDistance, freeDistance);
 
 	Lock lock(areaMutex);
-	// FIXME: Do not access Area directly
 
 	rmg::Area clearedTiles(dAreaFree);
 	rmg::Area possibleTiles(dAreaPossible);

+ 0 - 1
lib/rmg/modificators/ConnectionsPlacer.cpp

@@ -419,7 +419,6 @@ void ConnectionsPlacer::selfSideIndirectConnection(const rmg::ZoneConnection & c
 				manager.placeObject(rmgGate1, guarded1, true, allowRoad);
 				managerOther.placeObject(rmgGate2, guarded2, true, allowRoad);
 
-				// FIXME: Guard can still be placed on the object
 				replaceWithCurvedPath(path1, zone, rmgGate1.getVisitablePosition());
 				replaceWithCurvedPath(path2, *otherZone, rmgGate2.getVisitablePosition());