Allow for ammos w/o teleports
authornemo
Mon, 08 Feb 2010 12:46:09 +0000
changeset 2764 2613de505d8d
parent 2763 f21d3ca74ef2
child 2765 8a5685581aeb
Allow for ammos w/o teleports
hedgewars/uAmmos.pas
--- a/hedgewars/uAmmos.pas	Mon Feb 08 05:17:59 2010 +0000
+++ b/hedgewars/uAmmos.pas	Mon Feb 08 12:46:09 2010 +0000
@@ -54,6 +54,7 @@
 FillChar(mi, sizeof(mi), 0);
 FillChar(Ammo^, sizeof(Ammo^), 0);
 for a:= Low(TAmmoType) to High(TAmmoType) do
+    begin
     if cnts[a] > 0 then
        begin
        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
@@ -63,9 +64,22 @@
        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= cnts[a];
 
        if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
-          Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
+           Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
        inc(mi[Ammoz[a].Slot])
        end
+    else if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
+       begin
+       TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
+       Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
+
+       Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= 0;
+       Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= 0;
+
+       if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
+           Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
+       inc(mi[Ammoz[a].Slot])
+       end
+    end
 end;
 
 procedure AddAmmoStore(s: shortstring);