1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Do not fractalize tiles near the edge of the map to avoid paths adjacent to map edge

This commit is contained in:
Tomasz Zieliński 2023-12-18 08:14:48 +01:00
parent 339627731c
commit 24f74875ef

View File

@ -272,6 +272,16 @@ void Zone::fractalize()
{
//link tiles in random order
std::vector<int3> tilesToMakePath = possibleTiles.getTilesVector();
// Do not fractalize tiles near the edge of the map to avoid paths adjacent to map edge
const auto h = map.height();
const auto w = map.width();
const size_t MARGIN = 3;
vstd::erase_if(tilesToMakePath, [MARGIN, h, w](const int3 & tile)
{
return tile.x < MARGIN || tile.x > (w - MARGIN) ||
tile.y < MARGIN || tile.y > (h - MARGIN);
});
RandomGeneratorUtil::randomShuffle(tilesToMakePath, getRand());
int3 nodeFound(-1, -1, -1);