1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

Fix Subterranean Gates incorrectly placed outside the map

(cherry picked from commit acf455a1c3b02c0f8d5085c23fe2230779b7560b)
This commit is contained in:
Tomasz Zieliński 2023-07-18 09:53:42 +02:00
parent 545f047cae
commit e2940d2b0c

View File

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