gameServer/HWProtoInRoomState.hs
changeset 10017 de822cd3df3a
parent 10015 4feced261c68
child 10040 4ac87acbaed9
equal deleted inserted replaced
10015:4feced261c68 10017:de822cd3df3a
   213     let ri = clientRoom rnc ci
   213     let ri = clientRoom rnc ci
   214     let unreadyClients = filter (not . isReady) . map (client rnc) $ roomClients rnc ri
   214     let unreadyClients = filter (not . isReady) . map (client rnc) $ roomClients rnc ri
   215 
   215 
   216     gs <- if (not $ isReady cl) && (isSpecial rm) && (unreadyClients == [cl]) then startGame else return []
   216     gs <- if (not $ isReady cl) && (isSpecial rm) && (unreadyClients == [cl]) then startGame else return []
   217 
   217 
   218     return $ 
   218     return $
   219         ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)})
   219         ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)})
   220         : ModifyClient (\c -> c{isReady = not $ isReady cl})
   220         : ModifyClient (\c -> c{isReady = not $ isReady cl})
   221         : (AnswerClients chans $ if clientProto cl < 38 then
   221         : (AnswerClients chans $ if clientProto cl < 38 then
   222                 [if isReady cl then "NOT_READY" else "READY", nick cl]
   222                 [if isReady cl then "NOT_READY" else "READY", nick cl]
   223                 else
   223                 else
   234     rm <- thisRoom
   234     rm <- thisRoom
   235     chans <- roomOthersChans
   235     chans <- roomOthersChans
   236 
   236 
   237     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
   237     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
   238         return $ AnswerClients chans ["EM", legalMsgs]
   238         return $ AnswerClients chans ["EM", legalMsgs]
   239             : [ModifyRoom (\r -> r{gameInfo = liftM 
   239             : [ModifyRoom (\r -> r{gameInfo = liftM
   240                 (\g -> g{
   240                 (\g -> g{
   241                     roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g
   241                     roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g
   242                     , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg})
   242                     , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg})
   243                 $ gameInfo r})]
   243                 $ gameInfo r})]
   244         else
   244         else
   304 
   304 
   305     return $
   305     return $
   306         if not $ isMaster cl then
   306         if not $ isMaster cl then
   307             [ProtocolError $ loc "Not room master"]
   307             [ProtocolError $ loc "Not room master"]
   308         else
   308         else
   309         if illegalName newName then 
   309         if illegalName newName then
   310             [Warning $ loc "Illegal room name"]
   310             [Warning $ loc "Illegal room name"]
   311         else
   311         else
   312         if isSpecial rm then
   312         if isSpecial rm then
   313             [Warning $ loc "Restricted"]
   313             [Warning $ loc "Restricted"]
   314         else
   314         else