LuaAPI: fix OnHogAttack the incorrect AmmoType (amNothing) under certain conditions. Thanks for CheezeMonkey for reporting this
authorsheepluva
Tue, 26 May 2015 23:29:53 +0200
changeset 10970 7341e0c3f966
parent 10969 98cab7f366c3
child 10971 0e122b87ffbc
LuaAPI: fix OnHogAttack the incorrect AmmoType (amNothing) under certain conditions. Thanks for CheezeMonkey for reporting this
hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGearsHedgehog.pas	Wed May 27 10:37:12 2015 -0400
+++ b/hedgewars/uGearsHedgehog.pas	Tue May 26 23:29:53 2015 +0200
@@ -213,6 +213,7 @@
     speech: PVisualGear;
     newGear:  PGear;
     CurWeapon: PAmmo;
+    usedAmmoType: TAmmoType;
     altUse: boolean;
     elastic: hwFloat;
 begin
@@ -222,6 +223,7 @@
 with Gear^,
     Gear^.Hedgehog^ do
         begin
+        usedAmmoType:= CurAmmoType;
         if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstChooseTarget)) = 0) and (((State and gstMoving) = 0)
         or (Power > 0)
         or (CurAmmoType = amTeleport)
@@ -509,7 +511,7 @@
         else
             Message:= Message and (not gmAttack);
 
-    ScriptCall('onHogAttack', ord(CurAmmoType));
+    ScriptCall('onHogAttack', ord(usedAmmoType));
     end; // of with Gear^, Gear^.Hedgehog^ do
 
     TargetPoint.X := NoPointX;