# HG changeset patch
# User unc0rr
# Date 1267642022 0
# Node ID 0e95e0e24fd862918426b16787eb09cb1d378485
# Parent  616378221e5880063427ad6df713408c89fb085d
When removing team, set player's clan property to a colour of his another team

diff -r 616378221e58 -r 0e95e0e24fd8 gameServer/HWProtoInRoomState.hs
--- a/gameServer/HWProtoInRoomState.hs	Wed Mar 03 16:43:31 2010 +0000
+++ b/gameServer/HWProtoInRoomState.hs	Wed Mar 03 18:47:02 2010 +0000
@@ -73,7 +73,7 @@
     | nick client /= teamowner team = [ProtocolError "Not team owner!"]
     | otherwise =
             [RemoveTeam teamName,
-            ModifyClient (\c -> c{teamsInGame = teamsInGame c - 1})
+            ModifyClient (\c -> c{teamsInGame = teamsInGame c - 1, clientClan = if teamsInGame client == 1 then undefined else anotherTeamClan})
             ]
     where
         client = clients IntMap.! clID
@@ -81,6 +81,7 @@
         noSuchTeam = isNothing findTeam
         team = fromJust findTeam
         findTeam = find (\t -> teamName == teamname t) $ teams room
+        anotherTeamClan = teamcolor $ fromJust $ find (\t -> teamownerId t == clID) $ teams room
 
 
 handleCmd_inRoom clID clients rooms ["HH_NUM", teamName, numberStr]