clear gmAttack on attach to prevent a particularly nasty abuse found by the shoppa users.
authornemo
Wed, 03 Nov 2010 15:03:24 -0400
changeset 4103 aa932f2e6349
parent 4102 96efb3bbf8e3
child 4104 b94ff350d111
clear gmAttack on attach to prevent a particularly nasty abuse found by the shoppa users.
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Wed Nov 03 13:00:17 2010 -0400
+++ b/hedgewars/GSHandlers.inc	Wed Nov 03 15:03:24 2010 -0400
@@ -1319,7 +1319,7 @@
     DeleteCI(HHGear);
 
     if (HHGear^.State and gstMoving) <> 0 then
-    begin
+        begin
         if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX);
         if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, -1) then HHGear^.dY := _0;
 
@@ -1327,26 +1327,26 @@
         Gear^.X := Gear^.X + HHGear^.dX;
 
         if TestCollisionYwithGear(HHGear, 1) then
-        begin
+            begin
             CheckHHDamage(HHGear);
-            HHGear^.dY := _0;
+            HHGear^.dY := _0
             //HHGear^.State:= HHGear^.State and not (gstHHJumping or gstHHHJump);
-        end
+            end
         else
-        begin
+            begin
             HHGear^.Y := HHGear^.Y + HHGear^.dY;
             Gear^.Y := Gear^.Y + HHGear^.dY;
-            HHGear^.dY := HHGear^.dY + cGravity;
-        end;
+            HHGear^.dY := HHGear^.dY + cGravity
+            end;
 
         tt := Gear^.Elasticity;
         tx := _0;
         ty := _0;
         while tt > _20 do
-        begin
+            begin
             if  TestCollisionXwithXYShift(Gear, tx, hwRound(ty), -hwSign(Gear^.dX))
                or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), -hwSign(Gear^.dY)) then
-            begin
+                begin
                 Gear^.X := Gear^.X + tx;
                 Gear^.Y := Gear^.Y + ty;
                 Gear^.Elasticity := tt;
@@ -1359,12 +1359,12 @@
 
                 tt := _0;
                 exit
-            end;
+                end;
             tx := tx + Gear^.dX + Gear^.dX;
             ty := ty + Gear^.dY + Gear^.dY;
             tt := tt - _2;
+            end;
         end;
-    end;
 
     CheckCollision(Gear);
 
@@ -1372,29 +1372,32 @@
         if Gear^.Elasticity < _10 then
             Gear^.Elasticity := _10000
     else
-    begin
+        begin
         Gear^.doStep := @doStepRopeWork;
         PlaySound(sndRopeAttach);
         with HHGear^ do
+            begin
             State := State and not (gstAttacking or gstHHJumping or gstHHHJump);
+            Message := Message and not gmAttack
+            end;
 
         RemoveFromAmmo;
 
         exit
-    end;
+        end;
 
     if (Gear^.Elasticity > Gear^.Friction)
        or ((Gear^.Message and gmAttack) = 0)
        or ((HHGear^.State and gstHHDriven) = 0)
        or (HHGear^.Damage > 0) then
-    begin
+        begin
         with PHedgehog(Gear^.Hedgehog)^.Gear^ do
-        begin
+            begin
             State := State and not gstAttacking;
             Message := Message and not gmAttack
-        end;
+            end;
         DeleteGear(Gear)
-    end
+        end
 end;
 
 procedure doStepRope(Gear: PGear);