浏览代码

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

DjWarmonger 11 年之前
父节点
当前提交
dd0033b5a4
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      lib/rmg/CZonePlacer.cpp

+ 2 - 2
lib/rmg/CZonePlacer.cpp

@@ -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)
 			{