浏览代码

Fix Subterranean Gates incorrectly placed outside the map

(cherry picked from commit acf455a1c3b02c0f8d5085c23fe2230779b7560b)
Tomasz Zieliński 2 年之前
父节点
当前提交
e2940d2b0c
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      lib/rmg/modificators/ConnectionsPlacer.cpp

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

@@ -334,7 +334,17 @@ void ConnectionsPlacer::selfSideIndirectConnection(const rmg::ZoneConnection & c
 				if(dist < minDist || otherDist < minDist)
 					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)
+				{
+					if (map.isOnMap(tile))
+					{
+						toPlace.add(tile);
+					}
+				}
 				toPlace.translate(-zShift);
 				
 				path2 = managerOther.placeAndConnectObject(toPlace, rmgGate2, minDist, guarded2, true, ObjectManager::OptimizeType::NONE);