gameServer/HWProtoLobbyState.hs
changeset 4942 1c85a8e6e11c
parent 4941 90572c338e60
child 4975 31da8979e5b1
equal deleted inserted replaced
4941:90572c338e60 4942:1c85a8e6e11c
    38                 showB $ gameinprogress r,
    38                 showB $ gameinprogress r,
    39                 name r,
    39                 name r,
    40                 showB $ playersIn r,
    40                 showB $ playersIn r,
    41                 showB $ length $ teams r,
    41                 showB $ length $ teams r,
    42                 nick $ irnc `client` masterID r,
    42                 nick $ irnc `client` masterID r,
    43                 head (Map.findWithDefault ["+rnd+"] "MAP" (mapParams r)),
    43                 Map.findWithDefault "+rnd+" "MAP" (mapParams r),
    44                 head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
    44                 head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
    45                 head (Map.findWithDefault ["Default"] "AMMO" (params r))
    45                 head (Map.findWithDefault ["Default"] "AMMO" (params r))
    46                 ]
    46                 ]
    47 
    47 
    48 
    48 
    96             ++ answerFullConfig cl (mapParams jRoom) (params jRoom)
    96             ++ answerFullConfig cl (mapParams jRoom) (params jRoom)
    97             ++ answerTeams cl jRoom
    97             ++ answerTeams cl jRoom
    98             ++ watchRound cl jRoom
    98             ++ watchRound cl jRoom
    99 
    99 
   100         where
   100         where
   101         readynessMessage cl c = AnswerClients [sendChan cl] ["CLIENT_FLAGS", if isReady c then "+r" else "-r", nick c]
   101         readynessMessage cl c = AnswerClients [sendChan cl] $
       
   102                 if clientProto cl < 38 then
       
   103                     [if isReady c then "READY" else "NOT_READY", nick c]
       
   104                     else
       
   105                     ["CLIENT_FLAGS", if isReady c then "+r" else "-r", nick c]
   102 
   106 
   103         toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
   107         toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
   104 
   108 
   105         answerFullConfig cl mpr pr = map (toAnswer cl) $
   109         answerFullConfig cl mpr pr
       
   110             | clientProto cl < 38 = map (toAnswer cl) $
       
   111                  (map (\(a, b) -> (a, [b])) $ Map.toList mpr)
       
   112                  ++ (("SCHEME", pr Map.! "SCHEME")
       
   113                  : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr))
       
   114 
       
   115             | otherwise = map (toAnswer cl) $
   106                  ("FULLMAPCONFIG", Map.elems mpr)
   116                  ("FULLMAPCONFIG", Map.elems mpr)
   107                  : ("SCHEME", pr Map.! "SCHEME")
   117                  : ("SCHEME", pr Map.! "SCHEME")
   108                  : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr)
   118                  : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr)
   109 
   119 
   110         answerTeams cl jRoom = let f = if gameinprogress jRoom then teamsAtStart else teams in answerAllTeams cl $ f jRoom
   120         answerTeams cl jRoom = let f = if gameinprogress jRoom then teamsAtStart else teams in answerAllTeams cl $ f jRoom