hedgewars/CCHandlers.inc
changeset 2874 3c7c2bf1ba38
parent 2855 7e6adeb57427
child 2881 70d7976fa829
--- a/hedgewars/CCHandlers.inc	Fri Feb 26 16:29:00 2010 +0000
+++ b/hedgewars/CCHandlers.inc	Fri Feb 26 19:52:22 2010 +0000
@@ -73,12 +73,13 @@
 
 procedure chAddTeam(var s: shortstring);
 var Color: Longword;
-    ts: shortstring;
+    ts, cs: shortstring;
 begin
 if isDeveloperMode then
    begin
-   SplitBySpace(s, ts);
-   val(s, Color);
+   SplitBySpace(s, cs);
+   SplitBySpace(cs, ts);
+   val(cs, Color);
    TryDo(Color <> 0, 'Error: black team color', true);
 
    // color is always little endian so the mask must be constant also in big endian archs
@@ -86,6 +87,7 @@
  	
    AddTeam(Color);
    CurrentTeam^.TeamName:= ts;
+   CurrentTeam^.PlayerHash:= s;
    if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
 
    CurrentTeam^.voicepack:= AskForVoicepack('Default')
@@ -169,7 +171,9 @@
 with CurrentTeam^ do
     begin
     if not CurrentHedgehog^.King then
-       if (s = '') or (((GameFlags and gfKing) <> 0) and (s = 'crown')) then
+       if (s = '') or 
+          (((GameFlags and gfKing) <> 0) and (s = 'crown')) or
+          ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
            CurrentHedgehog^.Hat:= 'NoHat'
        else
            CurrentHedgehog^.Hat:= s