1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-09 13:14:02 +02:00

Do not fill water zone with obstacles

This commit is contained in:
Tomasz Zieliński 2024-02-04 08:55:51 +01:00
parent c09d577a24
commit 6528124c1e

View File

@ -116,6 +116,7 @@ void Zone::initFreeTiles()
if(dAreaFree.empty())
{
// Fixme: This might fail fot water zone, which doesn't need to have a tile in its center of the mass
dAreaPossible.erase(pos);
dAreaFree.add(pos); //zone must have at least one free tile where other paths go - for instance in the center
}
@ -250,6 +251,13 @@ void Zone::fractalize()
treasureDensity += t.density;
}
if (getType() == ETemplateZoneType::WATER)
{
// Set very little obstacles on water
spanFactor = 0.2;
}
else //Scale with treasure density
{
if (treasureValue > 400)
{
// A quater at max density
@ -265,6 +273,8 @@ void Zone::fractalize()
{
vstd::amin(spanFactor, 0.1f + 0.01f * treasureDensity); //Add extra obstacles to fill up space
}
}
float blockDistance = minDistance * spanFactor; //More obstacles in the Underground
freeDistance = freeDistance * marginFactor;
vstd::amax(freeDistance, 4 * 4);