hedgewars/uTeams.pas
changeset 371 731ad6d27bd1
parent 364 52cb4d6f84b7
child 393 db01cc79f278
equal deleted inserted replaced
370:c75410fe3133 371:731ad6d27bd1
    42              Color, AdjColor: Longword;
    42              Color, AdjColor: Longword;
    43              TeamName: string[MAXNAMELEN];
    43              TeamName: string[MAXNAMELEN];
    44              ExtDriven: boolean;
    44              ExtDriven: boolean;
    45              Binds: TBinds;
    45              Binds: TBinds;
    46              Hedgehogs: array[0..cMaxHHIndex] of THedgehog;
    46              Hedgehogs: array[0..cMaxHHIndex] of THedgehog;
    47              CurrHedgehog: integer;
    47              CurrHedgehog: LongInt;
    48              NameTag: PSDL_Surface;
    48              NameTag: PSDL_Surface;
    49              CrosshairSurf: PSDL_Surface;
    49              CrosshairSurf: PSDL_Surface;
    50              GraveRect, HealthRect: TSDL_Rect;
    50              GraveRect, HealthRect: TSDL_Rect;
    51              GraveName: string;
    51              GraveName: string;
    52              FortName: string;
    52              FortName: string;
    53              TeamHealth: integer;
    53              TeamHealth: LongInt;
    54              TeamHealthBarWidth: integer;
    54              TeamHealthBarWidth: LongInt;
    55              DrawHealthY: integer;
    55              DrawHealthY: LongInt;
    56              AttackBar: LongWord;
    56              AttackBar: LongWord;
    57              HedgehogsNumber: byte;
    57              HedgehogsNumber: byte;
    58              end;
    58              end;
    59 
    59 
    60 var CurrentTeam: PTeam = nil;
    60 var CurrentTeam: PTeam = nil;
    72 procedure SetWeapon(weap: TAmmoType);
    72 procedure SetWeapon(weap: TAmmoType);
    73 procedure SendStats;
    73 procedure SendStats;
    74 
    74 
    75 implementation
    75 implementation
    76 uses uMisc, uWorld, uAI, uLocale, uConsole;
    76 uses uMisc, uWorld, uAI, uLocale, uConsole;
    77 const MaxTeamHealth: integer = 0;
    77 const MaxTeamHealth: LongInt = 0;
    78 
    78 
    79 procedure FreeTeamsList; forward;
    79 procedure FreeTeamsList; forward;
    80 
    80 
    81 function CheckForWin: boolean;
    81 function CheckForWin: boolean;
    82 var team, AliveTeam: PTeam;
    82 var team, AliveTeam: PTeam;
   115 SendStats
   115 SendStats
   116 end;
   116 end;
   117 
   117 
   118 procedure SwitchHedgehog;
   118 procedure SwitchHedgehog;
   119 var tteam: PTeam;
   119 var tteam: PTeam;
   120     th: integer;
   120     th: LongInt;
   121     g: PGear;
   121     g: PGear;
   122 begin
   122 begin
   123 FreeActionsList;
   123 FreeActionsList;
   124 TargetPoint.X:= NoPointX;
   124 TargetPoint.X:= NoPointX;
   125 TryDo(CurrentTeam <> nil, 'nil Team', true);
   125 TryDo(CurrentTeam <> nil, 'nil Team', true);
   209       end
   209       end
   210 end;
   210 end;
   211 
   211 
   212 procedure InitTeams;
   212 procedure InitTeams;
   213 var p: PTeam;
   213 var p: PTeam;
   214     i: integer;
   214     i: LongInt;
   215     th: integer;
   215     th: LongInt;
   216 begin
   216 begin
   217 p:= TeamsList;
   217 p:= TeamsList;
   218 while p <> nil do
   218 while p <> nil do
   219       begin
   219       begin
   220       th:= 0;
   220       th:= 0;
   279     if p^.Hedgehogs[i].Gear <> nil then inc(Result);
   279     if p^.Hedgehogs[i].Gear <> nil then inc(Result);
   280 TeamSize:= Result
   280 TeamSize:= Result
   281 end;
   281 end;
   282 
   282 
   283 procedure RecountTeamHealth(team: PTeam);
   283 procedure RecountTeamHealth(team: PTeam);
   284 var i: integer;
   284 var i: LongInt;
   285 begin
   285 begin
   286 with team^ do
   286 with team^ do
   287      begin
   287      begin
   288      TeamHealthBarWidth:= 0;
   288      TeamHealthBarWidth:= 0;
   289      for i:= 0 to cMaxHHIndex do
   289      for i:= 0 to cMaxHHIndex do
   310       p:= p^.Next
   310       p:= p^.Next
   311       end;
   311       end;
   312 end;
   312 end;
   313 
   313 
   314 procedure SetWeapon(weap: TAmmoType);
   314 procedure SetWeapon(weap: TAmmoType);
   315 var t: integer;
   315 var t: LongInt;
   316 begin
   316 begin
   317 t:= cMaxSlotAmmoIndex;
   317 t:= cMaxSlotAmmoIndex;
   318 with CurrentTeam^ do
   318 with CurrentTeam^ do
   319      with Hedgehogs[CurrHedgehog] do
   319      with Hedgehogs[CurrHedgehog] do
   320           while (Ammo^[CurSlot, CurAmmo].AmmoType <> weap) and (t >= 0) do
   320           while (Ammo^[CurSlot, CurAmmo].AmmoType <> weap) and (t >= 0) do
   324                 end
   324                 end
   325 end;
   325 end;
   326 
   326 
   327 procedure SendStats;
   327 procedure SendStats;
   328 var p: PTeam;
   328 var p: PTeam;
   329     i: integer;
   329     i: LongInt;
   330     msd: Longword; msdhh: PHedgehog;
   330     msd: Longword; msdhh: PHedgehog;
   331 begin
   331 begin
   332 msd:= 0; msdhh:= nil;
   332 msd:= 0; msdhh:= nil;
   333 p:= TeamsList;
   333 p:= TeamsList;
   334 while p <> nil do
   334 while p <> nil do