hedgewars/uTeams.pas
changeset 307 96b428ac11f2
parent 306 7b61834edcf6
child 312 c36d0b34ac3d
equal deleted inserted replaced
306:7b61834edcf6 307:96b428ac11f2
    32                  AltSlot, AltAmmo: LongWord;
    32                  AltSlot, AltAmmo: LongWord;
    33                  Team: PTeam;
    33                  Team: PTeam;
    34                  AttacksNum: Longword;
    34                  AttacksNum: Longword;
    35                  visStepPos: LongWord;
    35                  visStepPos: LongWord;
    36                  BotLevel  : LongWord; // 0 - Human player
    36                  BotLevel  : LongWord; // 0 - Human player
       
    37                  DamageGiven: Longword;
       
    38                  MaxStepDamage: Longword;
    37                  end;
    39                  end;
    38      TTeam = record
    40      TTeam = record
    39              Next: PTeam;
    41              Next: PTeam;
    40              Color, AdjColor: Longword;
    42              Color, AdjColor: Longword;
    41              TeamName: string[MAXNAMELEN];
    43              TeamName: string[MAXNAMELEN];
    65 function  TeamSize(p: PTeam): Longword;
    67 function  TeamSize(p: PTeam): Longword;
    66 procedure RecountTeamHealth(team: PTeam);
    68 procedure RecountTeamHealth(team: PTeam);
    67 procedure RestoreTeamsFromSave;
    69 procedure RestoreTeamsFromSave;
    68 function CheckForWin: boolean;
    70 function CheckForWin: boolean;
    69 procedure SetWeapon(weap: TAmmoType);
    71 procedure SetWeapon(weap: TAmmoType);
       
    72 procedure SendStats;
    70 
    73 
    71 implementation
    74 implementation
    72 uses uMisc, uWorld, uAI, uLocale, uConsole;
    75 uses uMisc, uWorld, uAI, uLocale, uConsole;
    73 const MaxTeamHealth: integer = 0;
    76 const MaxTeamHealth: integer = 0;
    74 
    77 
   107    s:= Format(trmsg[sidWinner], AliveTeam.TeamName);
   110    s:= Format(trmsg[sidWinner], AliveTeam.TeamName);
   108    AddCaption(s, $FFFFFF, capgrpGameState);
   111    AddCaption(s, $FFFFFF, capgrpGameState);
   109    SendStat(siGameResult, s);
   112    SendStat(siGameResult, s);
   110    AddGear(0, 0, gtATFinishGame, 0, 0, 0, 2000)
   113    AddGear(0, 0, gtATFinishGame, 0, 0, 0, 2000)
   111    end;
   114    end;
       
   115 SendStats
   112 end;
   116 end;
   113 
   117 
   114 procedure SwitchHedgehog;
   118 procedure SwitchHedgehog;
   115 var tteam: PTeam;
   119 var tteam: PTeam;
   116     th: integer;
   120     th: integer;
   315                 ParseCommand('/slot ' + chr(49 + Ammoz[TAmmoType(weap)].Slot));
   319                 ParseCommand('/slot ' + chr(49 + Ammoz[TAmmoType(weap)].Slot));
   316                 dec(t)
   320                 dec(t)
   317                 end
   321                 end
   318 end;
   322 end;
   319 
   323 
       
   324 procedure SendStats;
       
   325 var p: PTeam;
       
   326     i: integer;
       
   327     msd: Longword; msdhh: PHedgehog;
       
   328 begin
       
   329 msd:= 0; msdhh:= nil;
       
   330 p:= TeamsList;
       
   331 while p <> nil do
       
   332       begin
       
   333       for i:= 0 to cMaxHHIndex do
       
   334           if p.Hedgehogs[i].MaxStepDamage > msd then
       
   335              begin
       
   336              msdhh:= @p.Hedgehogs[i];
       
   337              msd:= p.Hedgehogs[i].MaxStepDamage
       
   338              end;
       
   339       p:= p.Next
       
   340       end;
       
   341 if msdhh <> nil then SendStat(siMaxStepDamage, inttostr(msdhh.MaxStepDamage) + ' ' +
       
   342                                                msdhh.Name + ' (' + msdhh.Team.TeamName + ')');
       
   343 if KilledHHs > 0 then SendStat(siKilledHHs, inttostr(KilledHHs));
       
   344 end;
       
   345 
   320 initialization
   346 initialization
   321 
   347 
   322 finalization
   348 finalization
   323 
   349 
   324 FreeTeamsList
   350 FreeTeamsList