浏览代码

More tolerance for Subterranean Gates placement

Tomasz Zieliński 2 年之前
父节点
当前提交
29f023eaa5
共有 1 个文件被更改,包括 5 次插入9 次删除
  1. 5 9
      lib/rmg/modificators/ConnectionsPlacer.cpp

+ 5 - 9
lib/rmg/modificators/ConnectionsPlacer.cpp

@@ -334,16 +334,12 @@ void ConnectionsPlacer::selfSideIndirectConnection(const rmg::ZoneConnection & c
 					return -1.f;
 				
 				//This could fail is accessibleArea is below the map
-				rmg::Area toPlace(rmgGate1.getArea() + rmgGate1.getAccessibleArea());
-				auto inTheMap = toPlace.getTilesVector();
-				toPlace.clear();
-				for (const int3& tile : inTheMap)
+				rmg::Area toPlace(rmgGate1.getArea());
+				toPlace.unite(toPlace.getBorderOutside()); // Add a bit of extra space around
+				toPlace.erase_if([this](const int3 & tile)
 				{
-					if (map.isOnMap(tile))
-					{
-						toPlace.add(tile);
-					}
-				}
+					return !map.isOnMap(tile);
+				});
 				toPlace.translate(-zShift);
 				
 				path2 = managerOther.placeAndConnectObject(toPlace, rmgGate2, minDist, guarded2, true, ObjectManager::OptimizeType::NONE);