Fix a long-standing bug with ammo due to gstMoving being set on gears generically, causing an incorrect ammo type to be set. This caused crashes and incorrect ammo types.
authornemo
Thu, 11 Nov 2010 09:58:10 -0500
changeset 4238 6f1631765ebd
parent 4237 ef9b201c97fe
child 4239 eda0a8e2325f
Fix a long-standing bug with ammo due to gstMoving being set on gears generically, causing an incorrect ammo type to be set. This caused crashes and incorrect ammo types.
hedgewars/HHHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/HHHandlers.inc	Thu Nov 11 00:38:12 2010 +0100
+++ b/hedgewars/HHHandlers.inc	Thu Nov 11 09:58:10 2010 -0500
@@ -451,7 +451,7 @@
 case Gear^.Pos of
        posCaseUtility,
        posCaseAmmo: begin
-                    a:= TAmmoType(Gear^.State);
+                    a:= Gear^.AmmoType;
                     AddAmmo(PHedgehog(HH^.Hedgehog)^, a);
 // Possibly needs to check shared clan ammo game flag once added.
 // On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up
--- a/hedgewars/uGears.pas	Thu Nov 11 00:38:12 2010 +0100
+++ b/hedgewars/uGears.pas	Thu Nov 11 09:58:10 2010 -0500
@@ -1748,7 +1748,7 @@
               dec(t, Ammoz[i].Probability)
           end;
         FollowGear^.Pos:= posCaseAmmo;
-        FollowGear^.State:= Longword(i);
+        FollowGear^.AmmoType:= i;
         AddCaption(GetEventString(eidNewAmmoPack), cWhiteColor, capgrpAmmoInfo);
         end
     end
@@ -1767,7 +1767,7 @@
               dec(t, Ammoz[i].Probability)
           end;
         FollowGear^.Pos:= posCaseUtility;
-        FollowGear^.State:= Longword(i);
+        FollowGear^.AmmoType:= i;
         AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpAmmoInfo);
         end
     end;