hedgewars/uAmmos.pas
changeset 2221 ef52dae4130b
parent 2176 fc082baf448c
child 2246 4f138785a3ff
equal deleted inserted replaced
2220:110266ba2ef7 2221:ef52dae4130b
   157       ami:= 0;
   157       ami:= 0;
   158       while (not b) and (ami < cMaxSlotAmmoIndex) do
   158       while (not b) and (ami < cMaxSlotAmmoIndex) do
   159           if (Ammo^[Slot, ami].Count = 0)
   159           if (Ammo^[Slot, ami].Count = 0)
   160              and (Ammo^[Slot, ami + 1].Count > 0) then b:= true
   160              and (Ammo^[Slot, ami + 1].Count > 0) then b:= true
   161                                                   else inc(ami);
   161                                                   else inc(ami);
   162       if b then // there's a free item in ammo stack
   162       if b then // there is a free item in ammo stack
   163          begin
   163          begin
   164          Ammo^[Slot, ami]:= Ammo^[Slot, ami + 1];
   164          Ammo^[Slot, ami]:= Ammo^[Slot, ami + 1];
   165          Ammo^[Slot, ami + 1].Count:= 0
   165          Ammo^[Slot, ami + 1].Count:= 0
   166          end;
   166          end;
   167     until not b;
   167     until not b;