1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #3131 from vcmi/improve_subterranean_gates

More tolerance for Subterranean Gates placement
This commit is contained in:
DjWarmonger 2023-11-15 09:23:21 +01:00 committed by GitHub
commit ad9acd4b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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