hedgewars/uAmmos.pas
changeset 2764 2613de505d8d
parent 2762 2fbc8d35eb52
child 2766 aa3120a9e22c
equal deleted inserted replaced
2763:f21d3ca74ef2 2764:2613de505d8d
    52     a: TAmmoType;
    52     a: TAmmoType;
    53 begin
    53 begin
    54 FillChar(mi, sizeof(mi), 0);
    54 FillChar(mi, sizeof(mi), 0);
    55 FillChar(Ammo^, sizeof(Ammo^), 0);
    55 FillChar(Ammo^, sizeof(Ammo^), 0);
    56 for a:= Low(TAmmoType) to High(TAmmoType) do
    56 for a:= Low(TAmmoType) to High(TAmmoType) do
       
    57     begin
    57     if cnts[a] > 0 then
    58     if cnts[a] > 0 then
    58        begin
    59        begin
    59        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
    60        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
    60        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
    61        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
    61 
    62 
    62        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= cnts[a];
    63        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= cnts[a];
    63        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= cnts[a];
    64        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= cnts[a];
    64 
    65 
    65        if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
    66        if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
    66           Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
    67            Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
    67        inc(mi[Ammoz[a].Slot])
    68        inc(mi[Ammoz[a].Slot])
    68        end
    69        end
       
    70     else if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
       
    71        begin
       
    72        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
       
    73        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
       
    74 
       
    75        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= 0;
       
    76        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= 0;
       
    77 
       
    78        if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
       
    79            Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
       
    80        inc(mi[Ammoz[a].Slot])
       
    81        end
       
    82     end
    69 end;
    83 end;
    70 
    84 
    71 procedure AddAmmoStore(s: shortstring);
    85 procedure AddAmmoStore(s: shortstring);
    72 const probability: array [0..8] of LongWord = (0,20,30,60,100,150,200,400,600);
    86 const probability: array [0..8] of LongWord = (0,20,30,60,100,150,200,400,600);
    73 var cnt: Longword;
    87 var cnt: Longword;