When removing team, set player's clan property to a colour of his another team
authorunc0rr
Wed, 03 Mar 2010 18:47:02 +0000
changeset 2928 0e95e0e24fd8
parent 2927 616378221e58
child 2929 dd4efe601bc6
When removing team, set player's clan property to a colour of his another team
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]