Make FindPlace more flexible on large maps.
--- a/hedgewars/uGearsUtils.pas Wed Nov 07 23:08:02 2012 +0400
+++ b/hedgewars/uGearsUtils.pas Wed Nov 07 15:37:02 2012 -0500
@@ -555,8 +555,8 @@
procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean);
var x: LongInt;
y, sy: LongInt;
- ar: array[0..511] of TPoint;
- ar2: array[0..1023] of TPoint;
+ ar: array[0..1023] of TPoint;
+ ar2: array[0..2047] of TPoint;
cnt, cnt2: Longword;
delta: LongInt;
ignoreNearObjects, ignoreOverlap, tryAgain: boolean;
@@ -566,10 +566,10 @@
tryAgain:= true;
while tryAgain do
begin
- delta:= 250;
+ delta:= LAND_WIDTH div 16;
cnt2:= 0;
repeat
- x:= Left + LongInt(GetRandom(Delta));
+ x:= Left + max(LAND_WIDTH div 2048, LongInt(GetRandom(Delta)));
repeat
inc(x, Delta);
cnt:= 0;