|
|
@@ -185,8 +185,8 @@ void ConnectionsPlacer::selfSideDirectConnection(const rmg::ZoneConnection & con
|
|
|
return 1.f / (1.f + border.distanceSqr(d));
|
|
|
};
|
|
|
|
|
|
- auto ourArea = zone.areaPossible() + zone.freePaths();
|
|
|
- auto theirArea = otherZone->areaPossible() + otherZone->freePaths();
|
|
|
+ auto ourArea = zone.areaForRoads();
|
|
|
+ auto theirArea = otherZone->areaForRoads();
|
|
|
theirArea.add(potentialPos);
|
|
|
rmg::Path ourPath(ourArea);
|
|
|
rmg::Path theirPath(theirArea);
|
|
|
@@ -278,24 +278,22 @@ void ConnectionsPlacer::selfSideDirectConnection(const rmg::ZoneConnection & con
|
|
|
assert(zone.getModificator<ObjectManager>());
|
|
|
auto & manager = *zone.getModificator<ObjectManager>();
|
|
|
auto * monsterType = manager.chooseGuard(connection.getGuardStrength(), true);
|
|
|
-
|
|
|
+
|
|
|
rmg::Area border(zone.area()->getBorder());
|
|
|
border.unite(otherZone->area()->getBorder());
|
|
|
-
|
|
|
- auto costFunction = [&border](const int3 & s, const int3 & d)
|
|
|
- {
|
|
|
- return 1.f / (1.f + border.distanceSqr(d));
|
|
|
- };
|
|
|
-
|
|
|
- auto ourArea = zone.areaPossible() + zone.freePaths();
|
|
|
- auto theirArea = otherZone->areaPossible() + otherZone->freePaths();
|
|
|
+
|
|
|
+ auto localCostFunction = rmg::Path::createCurvedCostFunction(zone.area()->getBorder());
|
|
|
+ auto otherCostFunction = rmg::Path::createCurvedCostFunction(otherZone->area()->getBorder());
|
|
|
+
|
|
|
+ auto ourArea = zone.areaForRoads();
|
|
|
+ auto theirArea = otherZone->areaForRoads();
|
|
|
theirArea.add(guardPos);
|
|
|
rmg::Path ourPath(ourArea);
|
|
|
rmg::Path theirPath(theirArea);
|
|
|
ourPath.connect(zone.freePaths().get());
|
|
|
- ourPath = ourPath.search(guardPos, true, costFunction);
|
|
|
+ ourPath = ourPath.search(guardPos, true, localCostFunction);
|
|
|
theirPath.connect(otherZone->freePaths().get());
|
|
|
- theirPath = theirPath.search(guardPos, true, costFunction);
|
|
|
+ theirPath = theirPath.search(guardPos, true, otherCostFunction);
|
|
|
|
|
|
if(ourPath.valid() && theirPath.valid())
|
|
|
{
|
|
|
@@ -417,11 +415,14 @@ void ConnectionsPlacer::selfSideIndirectConnection(const rmg::ZoneConnection & c
|
|
|
|
|
|
if(path1.valid() && path2.valid())
|
|
|
{
|
|
|
- zone.connectPath(path1);
|
|
|
- otherZone->connectPath(path2);
|
|
|
-
|
|
|
manager.placeObject(rmgGate1, guarded1, true, allowRoad);
|
|
|
managerOther.placeObject(rmgGate2, guarded2, true, allowRoad);
|
|
|
+
|
|
|
+ replaceWithCurvedPath(path1, zone, rmgGate1.getVisitablePosition());
|
|
|
+ replaceWithCurvedPath(path2, *otherZone, rmgGate2.getVisitablePosition());
|
|
|
+
|
|
|
+ zone.connectPath(path1);
|
|
|
+ otherZone->connectPath(path2);
|
|
|
|
|
|
assert(otherZone->getModificator<ConnectionsPlacer>());
|
|
|
otherZone->getModificator<ConnectionsPlacer>()->otherSideConnection(connection);
|