Fix hammer shoving gears into indestructible land
authorWuzzy <Wuzzy2@mail.ru>
Thu, 02 Aug 2018 12:54:30 +0200
changeset 13602 0d920e370a78
parent 13601 d5f62417f014
child 13603 369efa5e01fa
Fix hammer shoving gears into indestructible land
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
--- a/ChangeLog.txt	Thu Aug 02 06:27:18 2018 +0200
+++ b/ChangeLog.txt	Thu Aug 02 12:54:30 2018 +0200
@@ -11,6 +11,7 @@
  + New default brown clan color for better contrast
  * Functionality of controllers restored
  * Fix crash when 2 or more controllers were connected
+ * Hammer no longer destroys land if indestructible terrain is enabled
  * Fix hammer and pickhammer not digging correctly at wrap world edge
  * Fix freezer ray not working through wrap world edge
  * Fix freezer ray going through bounce world edge
--- a/hedgewars/uGearsHandlersMess.pas	Thu Aug 02 06:27:18 2018 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Aug 02 12:54:30 2018 +0200
@@ -5621,7 +5621,6 @@
         if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then
             begin
             dmg:= 0;
-            //tmp^.State:= tmp^.State or gstFlatened;
             if (tmp^.Kind <> gtHedgehog) or (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then
                 begin
                 // base damage on remaining health
@@ -5634,12 +5633,12 @@
                     if dmg > 0 then
                         ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown);
                     end;
-		tmp^.dY:= _0_03 * Gear^.Boom
+                if (GameFlags and gfSolidLand) <> 0 then
+                    tmp^.dY:= _0_03 * Gear^.Boom;
                 end;
 
             if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then
                 begin
-                //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
                 tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
                 tmp2^.LinkedGear:= tmp;
                 SetAllToActive
@@ -5681,11 +5680,8 @@
             end;
 
         if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9)
-           , lfIndestructible) then
-            begin
-            //Gear^.X := Gear^.X + Gear^.dX;
-            Gear^.Y := Gear^.Y + _1_9
-            end;
+           , lfIndestructible) and ((GameFlags and gfSolidLand) = 0) then
+            Gear^.Y := Gear^.Y + _1_9;
         end;
     if TestCollisionYwithGear(Gear, 1) <> 0 then
         begin
@@ -5695,13 +5691,10 @@
         end
     else
         begin
-        //Gear^.dY := Gear^.dY + cGravity;
-        //Gear^.Y := Gear^.Y + Gear^.dY;
         if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
             Gear^.Timer := 1
         end;
 
-    //Gear^.X := Gear^.X + HitGear^.dX;
     HitGear^.X := Gear^.X;
     HitGear^.Y := Gear^.Y;
     SetLittle(HitGear^.dY);