mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Working fir for Corpse issue:
- Do not place guard next to blockVis object, if possible - Do not place two blockVis objects next to each other
This commit is contained in:
@ -664,7 +664,19 @@ bool ObjectManager::addGuard(rmg::Object & object, si32 strength, bool zoneGuard
|
||||
if(!guard)
|
||||
return false;
|
||||
|
||||
rmg::Area visitablePos({object.getVisitablePosition()});
|
||||
// Prefer non-blocking tiles, if any
|
||||
auto entrableTiles = object.getEntrableArea().getTiles();
|
||||
int3 entrableTile;
|
||||
if (entrableTiles.empty())
|
||||
{
|
||||
entrableTile = object.getVisitablePosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
*RandomGeneratorUtil::nextItem(entrableTiles, zone.getRand());
|
||||
}
|
||||
|
||||
rmg::Area visitablePos({entrableTile});
|
||||
visitablePos.unite(visitablePos.getBorderOutside());
|
||||
|
||||
auto accessibleArea = object.getAccessibleArea();
|
||||
|
Reference in New Issue
Block a user