Scan from right too. Not sure this is actually helpful, so committing separately.
authornemo
Fri, 25 Sep 2015 23:31:16 -0400
changeset 11197 283b6e6cf7ea
parent 11196 0f6916065849
child 11200 f4cf2cdea8e5
child 11324 ac6715709812
child 11326 721210d689a5
Scan from right too. Not sure this is actually helpful, so committing separately.
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsUtils.pas	Fri Sep 25 23:30:21 2015 -0400
+++ b/hedgewars/uGearsUtils.pas	Fri Sep 25 23:31:16 2015 -0400
@@ -829,7 +829,7 @@
 
 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean);
 var x: LongInt;
-    y, sy: LongInt;
+    y, sy, dir: LongInt;
     ar: array[0..1023] of TPoint;
     ar2: array[0..2047] of TPoint;
     temp: TPoint;
@@ -850,7 +850,9 @@
     delta:= LAND_WIDTH div 16;
     cnt2:= 0;
     repeat
-        x:= Left + max(LAND_WIDTH div 2048, LongInt(GetRandom(Delta)));
+        if GetRandom(2) = 0 then dir:= -1 else dir:= 1;
+        x:= max(LAND_WIDTH div 2048, LongInt(GetRandom(Delta)));
+        if dir = 1 then x:= Left + x else x:= Right - x; 
         repeat
             cnt:= 0;
             y:= min(1024, topY) - Gear^.Radius shl 1;
@@ -900,10 +902,10 @@
                     ar2[cnt2].x:= x;
                     ar2[cnt2].y:= y;
                     inc(cnt2)
-                    end
+                    end;
                 end;
-            inc(x, Delta)
-        until (x > Right);
+            inc(x, Delta*dir)
+        until ((dir = 1) and (x > Right)) or ((dir = -1) and (x < Left));
 
         dec(Delta, 60)
     until (cnt2 > 0) or (Delta < 70);