equal
deleted
inserted
replaced
94 , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick] |
94 , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick] |
95 ] |
95 ] |
96 ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients]) |
96 ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients]) |
97 ++ answerFullConfig cl (mapParams jRoom) (params jRoom) |
97 ++ answerFullConfig cl (mapParams jRoom) (params jRoom) |
98 ++ answerTeams cl jRoom |
98 ++ answerTeams cl jRoom |
99 ++ watchRound cl jRoom |
99 ++ watchRound cl jRoom chans |
100 |
100 |
101 where |
101 where |
102 readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c] |
102 readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c] |
103 sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $ |
103 sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $ |
104 [f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby] |
104 [f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby] |
120 : ("SCHEME", pr Map.! "SCHEME") |
120 : ("SCHEME", pr Map.! "SCHEME") |
121 : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr) |
121 : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr) |
122 |
122 |
123 answerTeams cl jRoom = let f = if isJust $ gameInfo jRoom then teamsAtStart . fromJust . gameInfo else teams in answerAllTeams cl $ f jRoom |
123 answerTeams cl jRoom = let f = if isJust $ gameInfo jRoom then teamsAtStart . fromJust . gameInfo else teams in answerAllTeams cl $ f jRoom |
124 |
124 |
125 watchRound cl jRoom = if isNothing $ gameInfo jRoom then |
125 watchRound cl jRoom chans = if isNothing $ gameInfo jRoom then |
126 [] |
126 [] |
127 else |
127 else |
128 [AnswerClients [sendChan cl] ["RUN_GAME"], |
128 [AnswerClients [sendChan cl] ["RUN_GAME"] |
129 AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : Foldable.toList (roundMsgs . fromJust . gameInfo $ jRoom)] |
129 , AnswerClients chans ["CLIENT_FLAGS", "+g", nick cl] |
|
130 , ModifyClient (\c -> c{isInGame = True}) |
|
131 , AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : Foldable.toList (roundMsgs . fromJust . gameInfo $ jRoom)] |
130 |
132 |
131 |
133 |
132 handleCmd_lobby ["JOIN_ROOM", roomName] = |
134 handleCmd_lobby ["JOIN_ROOM", roomName] = |
133 handleCmd_lobby ["JOIN_ROOM", roomName, ""] |
135 handleCmd_lobby ["JOIN_ROOM", roomName, ""] |
134 |
136 |