Ensure explosives are spawned somewhere w/ plenty of ground under them
authornemo
Wed, 03 Mar 2010 02:36:52 +0000
changeset 2914 7db64c269a5b
parent 2913 865ae941d59e
child 2915 a02f276035e8
Ensure explosives are spawned somewhere w/ plenty of ground under them
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Tue Mar 02 19:50:58 2010 +0000
+++ b/hedgewars/uGears.pas	Wed Mar 03 02:36:52 2010 +0000
@@ -2120,9 +2120,11 @@
 				inc(y);
 			until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) <> 0);
 
+// Flag the check for gtExplosives for reuse by other things that need a solid platform?
 			if (y - sy > Gear^.Radius * 2)
-				and (y < LAND_HEIGHT)
-				and (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 110, 110) = nil) then
+				and (((Gear^.Kind <> gtExplosives) and (y < LAND_HEIGHT)) or ((Gear^.Kind = gtExplosives) and (y < LAND_HEIGHT-1)))
+				and (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 110, 110) = nil)
+                and ((Gear^.Kind <> gtExplosives) or (CountNonZeroz(x, y+1, Gear^.Radius - 1, Gear^.Radius+1) > Gear^.Radius)) then
 				begin
 				ar[cnt].X:= x;
 				if withFall then ar[cnt].Y:= sy + Gear^.Radius