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

Optimization tweaks

This commit is contained in:
Tomasz Zieliński 2023-12-13 22:12:16 +01:00
parent 8602a14e6f
commit bfea30e318

View File

@ -890,18 +890,11 @@ void TreasurePlacer::createTreasures(ObjectManager& manager)
vstd::amin(bestDistance, distance);
}
auto guardedArea = rmgObject.instances().back()->getAccessibleArea();
const auto & guardedArea = rmgObject.instances().back()->getAccessibleArea();
auto areaToBlock = rmgObject.getAccessibleArea(true);
areaToBlock.subtract(guardedArea);
// TODO: Does it help?
areaToBlock.erase_if([this](const int3& tile) -> bool
{
//Don't block tiles outside the map
return (!map.isOnMap(tile));
});
if (areaToBlock.overlap(zone.freePaths()) || areaToBlock.overlap(manager.getVisitableArea()))
if (zone.freePaths().overlap(areaToBlock) || manager.getVisitableArea().overlap(areaToBlock))
return -1.f;
return bestDistance;