# HG changeset patch
# User nemo
# Date 1338779061 14400
# Node ID 80480d21e6ed478267741f288f5d7b9a015d2d92
# Parent  f68d62711a5cc3bc52a3f8b6925d28e502d7ae4b
Workaround for bug #144.  This workaround had occurred to me a while ago, but wasn't sure if placing them unfairly was better than not placing them at all.  Argument for not placing at all is people should probably abort the game when they notice it.  Argument for placing unfairly is people can still abort, and if we really wanted them to abort, we should probably just have halted launch if all hogs failed to spawn.  This way at least play can continue.

diff -r f68d62711a5c -r 80480d21e6ed hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Sun Jun 03 22:56:30 2012 -0400
+++ b/hedgewars/uGears.pas	Sun Jun 03 23:04:21 2012 -0400
@@ -826,7 +826,7 @@
                                 if PlacingHogs then
                                     Unplaced:= true
                                 else
-                                    FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil;
+                                    FindPlace(Gear, false, t, t + LAND_WIDTH div 2, true);// could make Gear == nil;
                                 if Gear <> nil then
                                     begin
                                     Gear^.Pos:= GetRandom(49);
@@ -859,7 +859,7 @@
         if PlacingHogs then
             ar[i]^.Unplaced:= true
         else
-            FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH);
+            FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH, true);
         if ar[i]^.Gear <> nil then
             begin
             ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > LAND_WIDTH div 2;