# HG changeset patch # User nemo # Date 1443238276 14400 # Node ID 283b6e6cf7ea7aa7652dc0f28dd1711da3a62ba7 # Parent 0f69160658491f8fd9a5164b86309e5ce9da74a6 Scan from right too. Not sure this is actually helpful, so committing separately. diff -r 0f6916065849 -r 283b6e6cf7ea 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);