Correctly check for failure to look up ammo, check for damaged mines
authornemo
Fri, 26 Aug 2011 21:38:11 -0400
changeset 5688 fba59d6b5b6c
parent 5687 fac606654317
child 5689 48ef34701751
Correctly check for failure to look up ammo, check for damaged mines
hedgewars/GSHandlers.inc
hedgewars/uAmmos.pas
--- a/hedgewars/GSHandlers.inc	Fri Aug 26 20:59:55 2011 -0400
+++ b/hedgewars/GSHandlers.inc	Fri Aug 26 21:38:11 2011 -0400
@@ -356,7 +356,7 @@
         Gear^.State := Gear^.State or      gstMoving;
 
     if (Gear^.nImpactSounds > 0) and 
-       ((Gear^.Damage <> 0) or 
+       (((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or 
           ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and
        (((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or
         ((Gear^.Radius >= 3) and ((Gear^.dX.QWordValue > _0_1.QWordValue) or 
--- a/hedgewars/uAmmos.pas	Fri Aug 26 20:59:55 2011 -0400
+++ b/hedgewars/uAmmos.pas	Fri Aug 26 21:38:11 2011 -0400
@@ -184,8 +184,9 @@
     a: PAmmo;
 begin
 a:= GetAmmoEntry(Hedgehog, ammo);
-cnt:= a^.Count;
-if (a^.AmmoType = amNothing) or (cnt <> AMMO_INFINITE) then
+if (a^.AmmoType <> amNothing) then cnt:= a^.Count
+else cnt:= 0;
+if (cnt <> AMMO_INFINITE) then
     begin
     inc(cnt, Ammoz[ammo].NumberInCase);
     AddAmmo(Hedgehog, ammo, cnt)