1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Do not place object visible tiles over the top of the map.

This commit is contained in:
Tomasz Zieliński
2023-04-10 19:26:53 +02:00
parent 9ea746a68c
commit 3c87b3934d
7 changed files with 57 additions and 1 deletions

View File

@ -112,6 +112,9 @@ int3 ObjectManager::findPlaceForObject(const rmg::Area & searchArea, rmg::Object
continue;
obj.setPosition(tile);
if (obj.getVisibleTop().y < 0)
continue;
if(!searchArea.contains(obj.getArea()) || !searchArea.overlap(obj.getAccessibleArea()))
continue;
@ -131,6 +134,9 @@ int3 ObjectManager::findPlaceForObject(const rmg::Area & searchArea, rmg::Object
for(const auto & tile : searchArea.getTiles())
{
obj.setPosition(tile);
if (obj.getVisibleTop().y < 0)
continue;
if(!searchArea.contains(obj.getArea()) || !searchArea.overlap(obj.getAccessibleArea()))
continue;