gameServer/HWProtoInRoomState.hs
branchwebgl
changeset 9521 8054d9d775fd
parent 9127 e350500c4edb
parent 9454 ac1874d56057
child 9950 2759212a27de
equal deleted inserted replaced
9282:92af50454cf2 9521:8054d9d775fd
   215     rm <- thisRoom
   215     rm <- thisRoom
   216     chans <- roomOthersChans
   216     chans <- roomOthersChans
   217 
   217 
   218     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
   218     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
   219         return $ AnswerClients chans ["EM", legalMsgs]
   219         return $ AnswerClients chans ["EM", legalMsgs]
   220             : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = nonEmptyMsgs : roundMsgs g}) $ gameInfo r}) | not $ B.null nonEmptyMsgs]
   220             : [ModifyRoom (\r -> r{gameInfo = liftM 
       
   221                 (\g -> g{
       
   222                     roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g
       
   223                     , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg})
       
   224                 $ gameInfo r})]
   221         else
   225         else
   222         return []
   226         return []
   223     where
   227     where
   224         (legalMsgs, nonEmptyMsgs) = checkNetCmd msg
   228         (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd msg
   225 
   229 
   226 
   230 
   227 handleCmd_inRoom ["ROUNDFINISHED", _] = do
   231 handleCmd_inRoom ["ROUNDFINISHED", _] = do
   228     cl <- thisClient
   232     cl <- thisClient
   229     rm <- thisRoom
   233     rm <- thisRoom
   280     chans <- sameProtoChans
   284     chans <- sameProtoChans
   281 
   285 
   282     return $
   286     return $
   283         if not $ isMaster cl then
   287         if not $ isMaster cl then
   284             [ProtocolError $ loc "Not room master"]
   288             [ProtocolError $ loc "Not room master"]
       
   289         else
       
   290         if illegalName newName then 
       
   291             [Warning $ loc "Illegal room name"]
   285         else
   292         else
   286         if isJust $ find (\r -> newName == name r) rs then
   293         if isJust $ find (\r -> newName == name r) rs then
   287             [Warning $ loc "Room with such name already exists"]
   294             [Warning $ loc "Room with such name already exists"]
   288         else
   295         else
   289             [ModifyRoom roomUpdate,
   296             [ModifyRoom roomUpdate,