This should fix Chip's bug with unlimited teleports. Also remove more hog placement special behaviour and just use ResetWeapons with a check against PlacingHogs mode
authornemo
Mon, 15 Nov 2010 14:39:58 -0500
changeset 4344 23ab3bdbf218
parent 4341 46b8791e577f
child 4346 3f8e41da82ee
This should fix Chip's bug with unlimited teleports. Also remove more hog placement special behaviour and just use ResetWeapons with a check against PlacingHogs mode
hedgewars/uAmmos.pas
hedgewars/uGears.pas
misc/hedgewars.png
--- a/hedgewars/uAmmos.pas	Mon Nov 15 04:30:11 2010 +0100
+++ b/hedgewars/uAmmos.pas	Mon Nov 15 14:39:58 2010 -0500
@@ -68,20 +68,7 @@
        begin
        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
-       with Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]] do
-           begin
-           Count:= cnts[a];
-           if (TotalRounds < 0) and ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then Count:= AMMO_INFINITE;
-           end;
-       inc(mi[Ammoz[a].Slot])
-       end
-    else if (TotalRounds < 0) and ((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:= AMMO_INFINITE;
-
+       with Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]] do Count:= cnts[a];
        inc(mi[Ammoz[a].Slot])
        end
     end
@@ -134,10 +121,14 @@
 
         if ((GameFlags and gfPlaceHog) <> 0) and
             (a <> amTeleport) and (a <> amSkip) and
-            (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000)
+            (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000);
+	if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then ammos[a]:= AMMO_INFINITE
         end 
     else ammos[a]:= AMMO_INFINITE;
-    InitialCounts[Pred(StoreCnt)][a]:= ammos[a];
+    if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
+    	InitialCounts[Pred(StoreCnt)][a]:= cnt
+    else
+    	InitialCounts[Pred(StoreCnt)][a]:= ammos[a];
     end;
 FillAmmoStore(StoresList[Pred(StoreCnt)], ammos)
 end;
--- a/hedgewars/uGears.pas	Mon Nov 15 04:30:11 2010 +0100
+++ b/hedgewars/uGears.pas	Mon Nov 15 14:39:58 2010 -0500
@@ -993,7 +993,7 @@
         t:= t^.NextGear
         end;
    
-    if (GameFlags and gfResetWeps) <> 0 then
+    if ((GameFlags and gfResetWeps) <> 0) and not PlacingHogs then
         ResetWeapons;
 
     if (GameFlags and gfResetHealth) <> 0 then
Binary file misc/hedgewars.png has changed