1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

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

This commit is contained in:
Tomasz Zieliński 2024-11-23 08:25:55 +01:00
parent f95bb58433
commit c8fcc6ffca
4 changed files with 3 additions and 5 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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());