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

Zones will now not bounce off map edges too much, should allow more space in the middle of a map.

This commit is contained in:
DjWarmonger 2014-10-31 17:55:47 +01:00
parent 9eeea7299a
commit dd0033b5a4

View File

@ -151,11 +151,11 @@ void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenera
//do not scale boundary distance - zones tend to get squashed
float size = zone.second->getSize() / mapSize;
auto pushAwayFromBoundary = [&forceVector, pos, &getDistance](float x, float y)
auto pushAwayFromBoundary = [&forceVector, pos, &getDistance, size](float x, float y)
{
float3 boundary = float3 (x, y, pos.z);
float distance = pos.dist2d(boundary);
forceVector -= (boundary - pos) / getDistance(distance); //negative value
forceVector -= (boundary - pos) * (size - distance) / getDistance(distance); //negative value
};
if (pos.x < size)
{