hedgewars/CCHandlers.inc
changeset 2874 3c7c2bf1ba38
parent 2855 7e6adeb57427
child 2881 70d7976fa829
equal deleted inserted replaced
2873:e7acb0251a22 2874:3c7c2bf1ba38
    71    end
    71    end
    72 end;
    72 end;
    73 
    73 
    74 procedure chAddTeam(var s: shortstring);
    74 procedure chAddTeam(var s: shortstring);
    75 var Color: Longword;
    75 var Color: Longword;
    76     ts: shortstring;
    76     ts, cs: shortstring;
    77 begin
    77 begin
    78 if isDeveloperMode then
    78 if isDeveloperMode then
    79    begin
    79    begin
    80    SplitBySpace(s, ts);
    80    SplitBySpace(s, cs);
    81    val(s, Color);
    81    SplitBySpace(cs, ts);
       
    82    val(cs, Color);
    82    TryDo(Color <> 0, 'Error: black team color', true);
    83    TryDo(Color <> 0, 'Error: black team color', true);
    83 
    84 
    84    // color is always little endian so the mask must be constant also in big endian archs
    85    // color is always little endian so the mask must be constant also in big endian archs
    85    Color:= Color or $FF000000;
    86    Color:= Color or $FF000000;
    86  	
    87  	
    87    AddTeam(Color);
    88    AddTeam(Color);
    88    CurrentTeam^.TeamName:= ts;
    89    CurrentTeam^.TeamName:= ts;
       
    90    CurrentTeam^.PlayerHash:= s;
    89    if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
    91    if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
    90 
    92 
    91    CurrentTeam^.voicepack:= AskForVoicepack('Default')
    93    CurrentTeam^.voicepack:= AskForVoicepack('Default')
    92    end
    94    end
    93 end;
    95 end;
   167 begin
   169 begin
   168 if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
   170 if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
   169 with CurrentTeam^ do
   171 with CurrentTeam^ do
   170     begin
   172     begin
   171     if not CurrentHedgehog^.King then
   173     if not CurrentHedgehog^.King then
   172        if (s = '') or (((GameFlags and gfKing) <> 0) and (s = 'crown')) then
   174        if (s = '') or 
       
   175           (((GameFlags and gfKing) <> 0) and (s = 'crown')) or
       
   176           ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
   173            CurrentHedgehog^.Hat:= 'NoHat'
   177            CurrentHedgehog^.Hat:= 'NoHat'
   174        else
   178        else
   175            CurrentHedgehog^.Hat:= s
   179            CurrentHedgehog^.Hat:= s
   176     end;
   180     end;
   177 end;
   181 end;