hedgewars/uAmmos.pas
changeset 4344 23ab3bdbf218
parent 4339 58d4733c9cad
child 4349 8efa91f98274
equal deleted inserted replaced
4341:46b8791e577f 4344:23ab3bdbf218
    66     begin
    66     begin
    67     if cnts[a] > 0 then
    67     if cnts[a] > 0 then
    68        begin
    68        begin
    69        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
    69        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
    70        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
    70        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
    71        with Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]] do
    71        with Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]] do Count:= cnts[a];
    72            begin
       
    73            Count:= cnts[a];
       
    74            if (TotalRounds < 0) and ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then Count:= AMMO_INFINITE;
       
    75            end;
       
    76        inc(mi[Ammoz[a].Slot])
       
    77        end
       
    78     else if (TotalRounds < 0) and ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then
       
    79        begin
       
    80        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
       
    81        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
       
    82 
       
    83        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
       
    84 
       
    85        inc(mi[Ammoz[a].Slot])
    72        inc(mi[Ammoz[a].Slot])
    86        end
    73        end
    87     end
    74     end
    88 end;
    75 end;
    89 
    76 
   132         if ((GameFlags and gfKing) <> 0) and ((GameFlags and gfPlaceHog) = 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then
   119         if ((GameFlags and gfKing) <> 0) and ((GameFlags and gfPlaceHog) = 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then
   133             Ammoz[a].SkipTurns:= 1;
   120             Ammoz[a].SkipTurns:= 1;
   134 
   121 
   135         if ((GameFlags and gfPlaceHog) <> 0) and
   122         if ((GameFlags and gfPlaceHog) <> 0) and
   136             (a <> amTeleport) and (a <> amSkip) and
   123             (a <> amTeleport) and (a <> amSkip) and
   137             (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000)
   124             (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000);
       
   125 	if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then ammos[a]:= AMMO_INFINITE
   138         end 
   126         end 
   139     else ammos[a]:= AMMO_INFINITE;
   127     else ammos[a]:= AMMO_INFINITE;
   140     InitialCounts[Pred(StoreCnt)][a]:= ammos[a];
   128     if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
       
   129     	InitialCounts[Pred(StoreCnt)][a]:= cnt
       
   130     else
       
   131     	InitialCounts[Pred(StoreCnt)][a]:= ammos[a];
   141     end;
   132     end;
   142 FillAmmoStore(StoresList[Pred(StoreCnt)], ammos)
   133 FillAmmoStore(StoresList[Pred(StoreCnt)], ammos)
   143 end;
   134 end;
   144 
   135 
   145 function GetAmmoByNum(num: Longword): PHHAmmo;
   136 function GetAmmoByNum(num: Longword): PHHAmmo;