hedgewars/uTeams.pas
changeset 534 92fb2b0d5117
parent 498 9c8b385dc9a1
child 540 b06c5aace2fa
equal deleted inserted replaced
533:eebb7684ac22 534:92fb2b0d5117
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  *)
    17  *)
    18 
    18 
    19 unit uTeams;
    19 unit uTeams;
    20 interface
    20 interface
    21 uses SDLh, uConsts, uKeys, uGears, uRandom, uAmmos, uFloat;
    21 uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat;
    22 {$INCLUDE options.inc}
    22 {$INCLUDE options.inc}
       
    23 
       
    24 type PHHAmmo = ^THHAmmo;
       
    25      THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
       
    26 
    23 type PHedgehog = ^THedgehog;
    27 type PHedgehog = ^THedgehog;
    24      PTeam     = ^TTeam;
    28      PTeam     = ^TTeam;
    25      THedgehog = record
    29      THedgehog = record
    26                  Name: string[MAXNAMELEN];
    30                  Name: string[MAXNAMELEN];
    27                  Gear: PGear;
    31                  Gear: PGear;
    71 function CheckForWin: boolean;
    75 function CheckForWin: boolean;
    72 procedure SetWeapon(weap: TAmmoType);
    76 procedure SetWeapon(weap: TAmmoType);
    73 procedure SendStats;
    77 procedure SendStats;
    74 
    78 
    75 implementation
    79 implementation
    76 uses uMisc, uWorld, uAI, uLocale, uConsole;
    80 uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos;
    77 const MaxTeamHealth: LongInt = 0;
    81 const MaxTeamHealth: LongInt = 0;
    78 
    82 
    79 procedure FreeTeamsList; forward;
    83 procedure FreeTeamsList; forward;
    80 
    84 
    81 function CheckForWin: boolean;
    85 function CheckForWin: boolean;
   126 tteam:= CurrentTeam;
   130 tteam:= CurrentTeam;
   127 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
   131 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
   128      if Gear <> nil then
   132      if Gear <> nil then
   129         begin
   133         begin
   130         Gear^.Message:= 0;
   134         Gear^.Message:= 0;
   131         Gear^.Z:= cHHZ
   135         Gear^.Z:= cHHZ;
       
   136         RemoveGearFromList(Gear);
       
   137         InsertGearToList(Gear)
   132         end;
   138         end;
   133 
   139 
   134 repeat
   140 repeat
   135   CurrentTeam:= CurrentTeam^.Next;
   141   CurrentTeam:= CurrentTeam^.Next;
   136   if CurrentTeam = nil then CurrentTeam:= TeamsList;
   142   if CurrentTeam = nil then CurrentTeam:= TeamsList;