gameServer/HWProtoInRoomState.hs
branch0.9.19
changeset 8924 13ac59499066
parent 8899 7493dde4ef51
child 8983 a25e18295959
--- a/gameServer/HWProtoInRoomState.hs	Sat Apr 20 02:17:53 2013 +0200
+++ b/gameServer/HWProtoInRoomState.hs	Sat Apr 20 02:20:15 2013 +0200
@@ -54,12 +54,12 @@
         roomChans <- roomClientsChans
         cl <- thisClient
         teamColor <-
-            if clientProto cl < 42 then 
+            if clientProto cl < 42 then
                 return color
                 else
                 liftM (head . (L.\\) (map B.singleton ['0'..]) . map teamcolor . teams) thisRoom
         let roomTeams = teams rm
-        let hhNum = let p = if not $ null roomTeams then hhnum $ head roomTeams else 4 in newTeamHHNum roomTeams p
+        let hhNum = let p = if not $ null roomTeams then minimum [hhnum $ head roomTeams, canAddNumber roomTeams] else 4 in newTeamHHNum roomTeams p
         let newTeam = clNick `seq` TeamInfo ci clNick tName teamColor grave fort voicepack flag dif hhNum (hhsList hhsInfo)
         return $
             if not . null . drop (maxTeams rm - 1) $ roomTeams then
@@ -79,10 +79,7 @@
                 AnswerClients clChan ["TEAM_ACCEPTED", tName],
                 AnswerClients othChans $ teamToNet $ newTeam,
                 AnswerClients roomChans ["TEAM_COLOR", tName, teamColor],
-                ModifyClient $ \c -> c{actionsPending = actionsPending cl
-                    ++ [AnswerClients clChan ["HH_NUM", tName, showB $ hhnum newTeam]]
-                    },
-                AnswerClients [sendChan cl] ["PING"]
+                AnswerClients roomChans ["HH_NUM", tName, showB $ hhnum newTeam]
                 ]
         where
         canAddNumber rt = (48::Int) - (sum $ map hhnum rt)