gameServer/HWProtoLobbyState.hs
changeset 1871 ce5854fbc631
parent 1866 36aa0ca6e8af
child 1905 b1ec8db513f2
equal deleted inserted replaced
1870:72af1c414345 1871:ce5854fbc631
    69 		[RoomRemoveThisClient, -- leave lobby
    69 		[RoomRemoveThisClient, -- leave lobby
    70 		RoomAddThisClient rID] -- join room
    70 		RoomAddThisClient rID] -- join room
    71 		++ answerNicks
    71 		++ answerNicks
    72 		++ answerReady
    72 		++ answerReady
    73 		++ [AnswerThisRoom ["NOT_READY", nick client]]
    73 		++ [AnswerThisRoom ["NOT_READY", nick client]]
    74 		++ answerFullConfig jRoom
    74 		++ answerFullConfig
    75 		++ answerTeams
    75 		++ answerTeams
    76 		++ watchRound
    76 		++ watchRound
    77 	where
    77 	where
    78 		noSuchRoom = isNothing mbRoom
    78 		noSuchRoom = isNothing mbRoom
    79 		mbRoom = find (\r -> roomName == name r && roomProto r == clientProto client) $ IntMap.elems rooms 
    79 		mbRoom = find (\r -> roomName == name r && roomProto r == clientProto client) $ IntMap.elems rooms 
    88 		answerReady =
    88 		answerReady =
    89 			map (\c -> AnswerThisClient [if isReady c then "READY" else "NOT_READY", nick c]) $
    89 			map (\c -> AnswerThisClient [if isReady c then "READY" else "NOT_READY", nick c]) $
    90 			map (\clID -> clients IntMap.! clID) roomClientsIDs
    90 			map (\clID -> clients IntMap.! clID) roomClientsIDs
    91 
    91 
    92 		toAnswer (paramName, paramStrs) = AnswerThisClient $ "CFG" : paramName : paramStrs
    92 		toAnswer (paramName, paramStrs) = AnswerThisClient $ "CFG" : paramName : paramStrs
    93 		answerFullConfig room = map toAnswer (Map.toList $ params room)
    93 		
       
    94 		answerFullConfig = map toAnswer (leftConfigPart ++ rightConfigPart)
       
    95 		(leftConfigPart, rightConfigPart) = partition (\(p, _) -> p /= "MAP") (Map.toList $ params jRoom)
    94 
    96 
    95 		watchRound = if not $ gameinprogress jRoom then
    97 		watchRound = if not $ gameinprogress jRoom then
    96 					[]
    98 					[]
    97 				else
    99 				else
    98 					[AnswerThisClient  ["RUN_GAME"],
   100 					[AnswerThisClient  ["RUN_GAME"],