hedgewars/uTeams.pas
changeset 14478 35724823b0d3
parent 14477 4b678aad50e9
child 14481 65b25ca6ff31
equal deleted inserted replaced
14477:4b678aad50e9 14478:35724823b0d3
    27 
    27 
    28 procedure initModule;
    28 procedure initModule;
    29 procedure freeModule;
    29 procedure freeModule;
    30 
    30 
    31 function  AddTeam(TeamColor: Longword): PTeam;
    31 function  AddTeam(TeamColor: Longword): PTeam;
    32 function  SetMissionTeam(TeamColor: Longword): PTeam;
    32 function  SetMissionTeam(): PTeam;
    33 procedure SwitchHedgehog;
    33 procedure SwitchHedgehog;
    34 procedure AfterSwitchHedgehog;
    34 procedure AfterSwitchHedgehog;
    35 procedure InitTeams;
    35 procedure InitTeams;
    36 function  TeamSize(p: PTeam): Longword;
    36 function  TeamSize(p: PTeam): Longword;
    37 procedure RecountTeamHealth(team: PTeam);
    37 procedure RecountTeamHealth(team: PTeam);
   475         end;
   475         end;
   476     ReadyTimeLeft:= 0
   476     ReadyTimeLeft:= 0
   477     end;
   477     end;
   478 end;
   478 end;
   479 
   479 
   480 function SetMissionTeam(TeamColor: Longword): PTeam;
   480 function SetMissionTeam(): PTeam;
   481 var team: PTeam;
   481 var team: PTeam;
   482 begin
   482 begin
   483 New(team);
   483 New(team);
   484 if checkFails(team <> nil, 'AddTeam: team = nil', true) then exit(nil);
   484 if checkFails(team <> nil, 'AddTeam: team = nil', true) then exit(nil);
   485 FillChar(team^, sizeof(TTeam), 0);
   485 FillChar(team^, sizeof(TTeam), 0);
   796         end
   796         end
   797     end
   797     end
   798 end;
   798 end;
   799 
   799 
   800 procedure chSetMissionTeam(var s: shortstring);
   800 procedure chSetMissionTeam(var s: shortstring);
   801 var Color: Longword;
   801 var ts, cs: shortstring;
   802     ts, cs: shortstring;
       
   803 begin
   802 begin
   804 cs:= '';
   803 cs:= '';
   805 ts:= '';
   804 ts:= '';
   806 if isDeveloperMode then
   805 if isDeveloperMode then
   807     begin
   806     begin
   808     SplitBySpace(s, cs);
   807     SplitBySpace(s, cs);
   809     SplitBySpace(cs, ts);
   808     SplitBySpace(cs, ts);
   810     Color:= StrToInt(cs);
   809 
   811 
   810     SetMissionTeam();
   812     // color is always little endian so the mask must be constant also in big endian archs
       
   813     Color:= Color or $FF000000;
       
   814     SetMissionTeam(Color);
       
   815 
   811 
   816     if CurrentTeam <> nil then
   812     if CurrentTeam <> nil then
   817         begin
   813         begin
   818         CurrentTeam^.TeamName:= ts;
   814         CurrentTeam^.TeamName:= ts;
   819         CurrentTeam^.PlayerHash:= s;
   815         CurrentTeam^.PlayerHash:= s;