gameServer/HWProtoLobbyState.hs
branchserver_refactor
changeset 4595 cd4433b44920
parent 4591 c91364bf6a69
child 4597 31e042ab870c
equal deleted inserted replaced
4593:39d07170085b 4595:cd4433b44920
    91                 AnswerClients [sendChan cl] $ "JOINED" : map nick jRoomClients
    91                 AnswerClients [sendChan cl] $ "JOINED" : map nick jRoomClients
    92             ]
    92             ]
    93             ++ (map (readynessMessage cl) jRoomClients)
    93             ++ (map (readynessMessage cl) jRoomClients)
    94             ++ (answerFullConfig cl $ params jRoom)
    94             ++ (answerFullConfig cl $ params jRoom)
    95             ++ (answerTeams cl jRoom)
    95             ++ (answerTeams cl jRoom)
       
    96             ++ (watchRound cl jRoom)
    96 
    97 
    97         where
    98         where
    98         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
    99         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
    99 
   100 
   100         toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
   101         toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
   102         answerFullConfig cl params = map (toAnswer cl) (leftConfigPart ++ rightConfigPart)
   103         answerFullConfig cl params = map (toAnswer cl) (leftConfigPart ++ rightConfigPart)
   103             where
   104             where
   104             (leftConfigPart, rightConfigPart) = partition (\(p, _) -> p /= "MAP") $ Map.toList params
   105             (leftConfigPart, rightConfigPart) = partition (\(p, _) -> p /= "MAP") $ Map.toList params
   105 
   106 
   106         answerTeams cl jRoom = let f = if gameinprogress jRoom then teamsAtStart else teams in answerAllTeams cl $ f jRoom
   107         answerTeams cl jRoom = let f = if gameinprogress jRoom then teamsAtStart else teams in answerAllTeams cl $ f jRoom
       
   108 
       
   109         watchRound cl jRoom = if not $ gameinprogress jRoom then
       
   110                     []
       
   111                 else
       
   112                     [AnswerClients [sendChan cl]  ["RUN_GAME"],
       
   113                     AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : Foldable.toList (roundMsgs jRoom)]
   107 
   114 
   108 
   115 
   109 
   116 
   110 {-
   117 {-
   111 
   118