# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1560795601 -7200
# Node ID 3cc1a79de3fd6b3ccd5c93961ab62cdab40accc3
# Parent  f532203c5ceb6bde3d7997e0b442bac1a8a8ab50
Fix air mine spawning inside land if land is almost completely full

Bug conditions:
* cAirMines >= 1
* Play with a drawn map filled with land

diff -r f532203c5ceb -r 3cc1a79de3fd hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Mon Jun 17 19:51:05 2019 +0200
+++ b/hedgewars/uGears.pas	Mon Jun 17 20:20:01 2019 +0200
@@ -783,7 +783,7 @@
 
 i:= 0;
 j:= 0;
-p:= 0; // 0 searching, 1 bad position, 2 added.
+p:= 0; // 0: good position, 1: bad position.
 unplaced:= 0;
 if cAirMines > 0 then
     Gear:= AddGear(0, 0, gtAirMine, 0, _0, _0, 0);
@@ -835,7 +835,9 @@
                 if i < cAirMines then
                     Gear:= AddGear(0, 0, gtAirMine, 0, _0, _0, 0)
                 end
-            end;
+            end
+        else
+            p:= 1;
         inc(j)
         end;
 if p <> 0 then DeleteGear(Gear);