1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Do not place guardes treasure on roads. Do not place guards next to roads.

This commit is contained in:
Tomasz Zieliński
2024-05-01 07:58:17 +02:00
parent 3749439702
commit 9301bb9af5
3 changed files with 37 additions and 2 deletions

View File

@@ -417,6 +417,24 @@ void rmg::Object::setGuardedIfMonster(const Instance& object)
}
}
int3 rmg::Object::getGuardPos() const
{
if (guarded)
{
for (auto & instance : dInstances)
{
if (instance.object().ID == Obj::MONSTER)
{
return instance.object().pos;
}
}
}
else
{
return int3(-1,-1,-1);
}
}
void Object::Instance::finalize(RmgMap & map, CRandomGenerator & rng)
{
if(!map.isOnMap(getPosition(true)))