mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-10 00:43:59 +02:00
Fix broken roads to portals or gates by the lower zone border
This commit is contained in:
parent
f95bb58433
commit
c8fcc6ffca
@ -24,13 +24,13 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
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 costFunction = rmg::Path::createCurvedCostFunction(zone.area()->getBorder());
|
||||||
auto pathArea = zone.areaForRoads();
|
auto pathArea = zone.areaForRoads();
|
||||||
rmg::Path curvedPath(pathArea);
|
rmg::Path curvedPath(pathArea);
|
||||||
curvedPath.connect(zone.freePaths().get());
|
curvedPath.connect(zone.freePaths().get());
|
||||||
curvedPath = curvedPath.search(src, false, costFunction);
|
curvedPath = curvedPath.search(src, onlyStraight, costFunction);
|
||||||
if (curvedPath.valid())
|
if (curvedPath.valid())
|
||||||
{
|
{
|
||||||
path = curvedPath;
|
path = curvedPath;
|
||||||
|
@ -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);
|
rmg::Tileset collectDistantTiles(const Zone & zone, int distance);
|
||||||
|
|
||||||
|
@ -304,7 +304,6 @@ void Zone::fractalize()
|
|||||||
logGlobal->trace("Zone %d: treasureValue %d blockDistance: %2.f, freeDistance: %2.f", getId(), treasureValue, blockDistance, freeDistance);
|
logGlobal->trace("Zone %d: treasureValue %d blockDistance: %2.f, freeDistance: %2.f", getId(), treasureValue, blockDistance, freeDistance);
|
||||||
|
|
||||||
Lock lock(areaMutex);
|
Lock lock(areaMutex);
|
||||||
// FIXME: Do not access Area directly
|
|
||||||
|
|
||||||
rmg::Area clearedTiles(dAreaFree);
|
rmg::Area clearedTiles(dAreaFree);
|
||||||
rmg::Area possibleTiles(dAreaPossible);
|
rmg::Area possibleTiles(dAreaPossible);
|
||||||
|
@ -419,7 +419,6 @@ void ConnectionsPlacer::selfSideIndirectConnection(const rmg::ZoneConnection & c
|
|||||||
manager.placeObject(rmgGate1, guarded1, true, allowRoad);
|
manager.placeObject(rmgGate1, guarded1, true, allowRoad);
|
||||||
managerOther.placeObject(rmgGate2, guarded2, true, allowRoad);
|
managerOther.placeObject(rmgGate2, guarded2, true, allowRoad);
|
||||||
|
|
||||||
// FIXME: Guard can still be placed on the object
|
|
||||||
replaceWithCurvedPath(path1, zone, rmgGate1.getVisitablePosition());
|
replaceWithCurvedPath(path1, zone, rmgGate1.getVisitablePosition());
|
||||||
replaceWithCurvedPath(path2, *otherZone, rmgGate2.getVisitablePosition());
|
replaceWithCurvedPath(path2, *otherZone, rmgGate2.getVisitablePosition());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user