gameServer/HWProtoInRoomState.hs
changeset 2928 0e95e0e24fd8
parent 2917 2f4320a1b31f
child 2952 18fada739b55
--- 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]