hedgewars/uTeams.pas
changeset 2726 a84fc5113d01
parent 2716 b9ca1bfca24f
child 2730 f56592281526
equal deleted inserted replaced
2725:89908847b155 2726:a84fc5113d01
    50 			visStepPos: LongWord;
    50 			visStepPos: LongWord;
    51 			BotLevel  : LongWord; // 0 - Human player
    51 			BotLevel  : LongWord; // 0 - Human player
    52 			HatVisibility: GLfloat;
    52 			HatVisibility: GLfloat;
    53 			stats: TStatistics;
    53 			stats: TStatistics;
    54 			Hat: String;
    54 			Hat: String;
       
    55             King: boolean;  // Flag for a bunch of hedgehog attributes
    55 			end;
    56 			end;
    56 
    57 
    57 	TTeam = record
    58 	TTeam = record
    58 			Clan: PClan;
    59 			Clan: PClan;
    59 			TeamName: string[MAXNAMELEN];
    60 			TeamName: string[MAXNAMELEN];
   192 		repeat
   193 		repeat
   193 			CurrTeam:= Succ(CurrTeam) mod TeamsNumber;
   194 			CurrTeam:= Succ(CurrTeam) mod TeamsNumber;
   194 			CurrentTeam:= Teams[CurrTeam];
   195 			CurrentTeam:= Teams[CurrTeam];
   195 			with CurrentTeam^ do
   196 			with CurrentTeam^ do
   196 				begin
   197 				begin
   197 				PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn
   198 				PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn)
   198 				repeat
   199 				repeat
   199 					CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
   200 					CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
   200 				until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
   201 				until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
   201 				end
   202 				end
   202 		until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam);
   203 		until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam);
   299 
   300 
   300 procedure InitTeams;
   301 procedure InitTeams;
   301 var i, t: LongInt;
   302 var i, t: LongInt;
   302     th: LongInt;
   303     th: LongInt;
   303 begin
   304 begin
       
   305 
       
   306 // Some initial King buffs
       
   307 if (GameFlags and gfKing) <> 0 then
       
   308    for i:= 0 to Pred(ClansCount) do 
       
   309       begin
       
   310       with ClansArray[i]^.Teams[0]^.Hedgehogs[0] do
       
   311          begin
       
   312          King:= true;
       
   313          Hat:= 'crown';
       
   314          Gear^.Health:= hwRound(int2hwFloat(Gear^.Health)*_1_5);
       
   315          Gear^.Invulnerable:= true
       
   316          end
       
   317       end;
       
   318 
   304 for t:= 0 to Pred(TeamsCount) do
   319 for t:= 0 to Pred(TeamsCount) do
   305    with TeamsArray[t]^ do
   320    with TeamsArray[t]^ do
   306       begin
   321       begin
   307       if (not ExtDriven) and (Hedgehogs[0].BotLevel = 0) then
   322       if (not ExtDriven) and (Hedgehogs[0].BotLevel = 0) then
   308           LocalClan:= Clan^.ClanIndex + 1;
   323           LocalClan:= Clan^.ClanIndex + 1;
   310       for i:= 0 to cMaxHHIndex do
   325       for i:= 0 to cMaxHHIndex do
   311           if Hedgehogs[i].Gear <> nil then
   326           if Hedgehogs[i].Gear <> nil then
   312              inc(th, Hedgehogs[i].Gear^.Health);
   327              inc(th, Hedgehogs[i].Gear^.Health);
   313       if th > MaxTeamHealth then MaxTeamHealth:= th;
   328       if th > MaxTeamHealth then MaxTeamHealth:= th;
   314       end;
   329       end;
       
   330 
   315 RecountAllTeamsHealth
   331 RecountAllTeamsHealth
   316 end;
   332 end;
   317 
   333 
   318 function  TeamSize(p: PTeam): Longword;
   334 function  TeamSize(p: PTeam): Longword;
   319 var i, value: Longword;
   335 var i, value: Longword;