gameServer/HWProtoInRoomState.hs
changeset 11556 af9aa8d5863c
parent 11508 a4ad8a9e0f69
child 11557 cf5d45444357
equal deleted inserted replaced
11555:b96080df19d0 11556:af9aa8d5863c
    52                         }
    52                         }
    53                     )
    53                     )
    54                 , AnswerClients chans ["RUN_GAME"]
    54                 , AnswerClients chans ["RUN_GAME"]
    55                 , SendUpdateOnThisRoom
    55                 , SendUpdateOnThisRoom
    56                 , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks
    56                 , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks
    57                 , ModifyRoomClients (\c -> c{isInGame = True})
    57                 , ModifyRoomClients (\c -> c{isInGame = True, teamIndexes = map snd . filter (\(t, _) -> teamowner t == nick cl) $ zip (teams rm) [0..]})
    58                 ]
    58                 ]
    59             else
    59             else
    60             return [Warning $ loc "Less than two clans!"]
    60             return [Warning $ loc "Less than two clans!"]
    61         else
    61         else
    62         return []
    62         return []
   258 handleCmd_inRoom ["EM", msg] = do
   258 handleCmd_inRoom ["EM", msg] = do
   259     cl <- thisClient
   259     cl <- thisClient
   260     rm <- thisRoom
   260     rm <- thisRoom
   261     chans <- roomOthersChans
   261     chans <- roomOthersChans
   262 
   262 
       
   263     let (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd (teamIndexes cl) msg
       
   264 
   263     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
   265     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
   264         return $ AnswerClients chans ["EM", legalMsgs]
   266         return $ AnswerClients chans ["EM", legalMsgs]
   265             : [ModifyRoom (\r -> r{gameInfo = liftM
   267             : [ModifyRoom (\r -> r{gameInfo = liftM
   266                 (\g -> g{
   268                 (\g -> g{
   267                     roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g
   269                     roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g
   268                     , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg})
   270                     , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg})
   269                 $ gameInfo r}), RegisterEvent EngineMessage]
   271                 $ gameInfo r}), RegisterEvent EngineMessage]
   270         else
   272         else
   271         return []
   273         return []
   272     where
       
   273         (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd msg
       
   274 
   274 
   275 
   275 
   276 handleCmd_inRoom ["ROUNDFINISHED", _] = do
   276 handleCmd_inRoom ["ROUNDFINISHED", _] = do
   277     cl <- thisClient
   277     cl <- thisClient
   278     rm <- thisRoom
   278     rm <- thisRoom