Don't try to spawn air mines beyond the bounce world edge
authorWuzzy <Wuzzy2@mail.ru>
Sun, 13 Jan 2019 15:54:10 +0100
changeset 14585 599f136d4f32
parent 14584 ca9c632db2cf
child 14586 833ab5b359e5
Don't try to spawn air mines beyond the bounce world edge
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Sun Jan 13 15:47:14 2019 +0100
+++ b/hedgewars/uGears.pas	Sun Jan 13 15:54:10 2019 +0100
@@ -767,16 +767,14 @@
     while (i < cAirMines) and (j < 1000*cAirMines) do
         begin
         p:= 0;
+        if (hasBorder) or (WorldEdge = weBounce) then
+            rx:= leftX+GetRandom(rightX-leftX-16)+8
+        else
+            rx:= leftX+GetRandom(rightX-leftX+400)-200;
         if hasBorder then
-            begin
-            rx:= leftX+GetRandom(rightX-leftX-16)+8;
             ry:= topY+GetRandom(LAND_HEIGHT-topY-16)+8
-            end
         else
-            begin
-            rx:= leftX+GetRandom(rightX-leftX+400)-200;
-            ry:= topY+GetRandom(LAND_HEIGHT-topY+400)-200
-            end;
+            ry:= topY+GetRandom(LAND_HEIGHT-topY+400)-200;
         Gear^.X:= int2hwFloat(CalcWorldWrap(rx,Gear^.Radius));
         Gear^.Y:= int2hwFloat(ry);
         if CheckLandValue(rx, ry, $FFFF) and