1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Add clearance under town to ensure passability.

This commit is contained in:
DjWarmonger 2016-12-21 10:43:24 +01:00
parent cc452bdfa9
commit a0596ebecf

View File

@ -1322,11 +1322,15 @@ void CRmgTemplateZone::initTownType (CMapGenerator* gen)
auto cutPathAroundTown = [gen, this](const CGTownInstance * town)
{
//cut contour around town entrance
for (auto pos: getAccessibleOffsets(gen, town))
//clear tiles under town to ensure passability
for (auto blockedTile : town->getBlockedPos())
{
gen->setOccupied(pos, ETileType::FREE);
};
gen->foreach_neighbour(blockedTile, [gen, town](const int3& pos)
{
if (pos.y > town->pos.y)
gen->setOccupied(pos, ETileType::FREE);
});
}
};
auto addNewTowns = [&totalTowns, gen, this, &cutPathAroundTown](int count, bool hasFort, PlayerColor player)