block spawning on ice slopes
authoralfadur
Thu, 10 Aug 2017 08:13:37 -0400
changeset 12449 8c5475bb4db7
parent 12448 8b89fe2115ad
child 12450 8e32d540dab5
block spawning on ice slopes
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsUtils.pas	Wed Aug 09 15:36:05 2017 -0400
+++ b/hedgewars/uGearsUtils.pas	Thu Aug 10 08:13:37 2017 -0400
@@ -893,11 +893,9 @@
                     inc(y);
                 until (y >= cWaterLine) or
                         (ignoreOverlap and 
-                                ((CountLand(x, y, Gear^.Radius - 1, 1, $FFFF, lfIce) <> 0) or
-                                 (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius + 1, lfIce, 0) > Gear^.Radius))) or
+                                (CountLand(x, y, Gear^.Radius - 1, 1, $FFFF, 0) <> 0)) or
                         (not ignoreOverlap and 
-                            ((CountLand(x, y, Gear^.Radius - 1, 1, lfLandMask, lfIce) <> 0) or
-                             (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius + 1, lfIce, 0) > Gear^.Radius)));
+                            (CountLand(x, y, Gear^.Radius - 1, 1, lfLandMask, 0) <> 0));
 
                 if (y - sy > Gear^.Radius * 2) and (y < cWaterLine)
                     and (((Gear^.Kind = gtExplosives)
@@ -908,7 +906,9 @@
                     or
                         ((Gear^.Kind <> gtExplosives)
                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 110, 110))
-                        )) then
+                        and (isSteadyPosition(x, y+1, Gear^.Radius - 1, 3, lfIce)
+                         or (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius+1, $FFFF, lfIce) <> 0)
+                            ))) then
                     begin
                     ar[cnt].X:= x;
                     if withFall then