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

Add some space around unguarded treasures.

This commit is contained in:
DjWarmonger 2014-12-26 21:13:13 +01:00
parent 53c39f7d05
commit fdd392e47c

View File

@ -886,6 +886,8 @@ bool CRmgTemplateZone::createTreasurePile(CMapGenerator* gen, int3 &pos, float m
});
}
bool isPileGuarded = currentValue >= minGuardedValue;
for (auto tile : boundary) //guard must be standing there
{
if (gen->isFree(tile)) //this tile could be already blocked, don't place a monster here
@ -916,8 +918,14 @@ bool CRmgTemplateZone::createTreasurePile(CMapGenerator* gen, int3 &pos, float m
gen->setOccupied(pos, ETileType::FREE);
});
}
else //mo monster in this pile, make some free space (needed?)
{
for (auto tile : boundary)
if (gen->isPossible(tile))
gen->setOccupied(tile, ETileType::FREE);
}
}
else //we couldn't make a connection to this location, block it
else if (isPileGuarded)//we couldn't make a connection to this location, block it
{
for (auto treasure : treasures)
{