gameServer/Actions.hs
changeset 4999 a3a09b107652
parent 4998 cdcdf37e5532
child 5003 db4726bf9205
equal deleted inserted replaced
4998:cdcdf37e5532 4999:a3a09b107652
   204             processAction RemoveRoom
   204             processAction RemoveRoom
   205         else
   205         else
   206         mapM_ processAction [AnswerClients chans ["LEFT", clNick, msg], RemoveClientTeams ci]
   206         mapM_ processAction [AnswerClients chans ["LEFT", clNick, msg], RemoveClientTeams ci]
   207 
   207 
   208     io $ do
   208     io $ do
   209             modifyRoom rnc (\r -> r{
   209         modifyRoom rnc (\r -> r{
   210                     playersIn = playersIn r - 1,
   210                 playersIn = playersIn r - 1,
   211                     readyPlayers = if ready then readyPlayers r - 1 else readyPlayers r
   211                 readyPlayers = if ready then readyPlayers r - 1 else readyPlayers r
   212                     }) ri
   212                 }) ri
   213             moveClientToLobby rnc ci
   213         moveClientToLobby rnc ci
   214 
   214 
   215 processAction ChangeMaster = do
   215 processAction ChangeMaster = do
   216     ri <- clientRoomA
   216     ri <- clientRoomA
   217     rnc <- gets roomsClients
   217     rnc <- gets roomsClients
   218     newMasterId <- liftM head . io $ roomClientsIndicesM rnc ri
   218     newMasterId <- liftM head . io $ roomClientsIndicesM rnc ri
   280 processAction (RemoveTeam teamName) = do
   280 processAction (RemoveTeam teamName) = do
   281     rnc <- gets roomsClients
   281     rnc <- gets roomsClients
   282     ri <- clientRoomA
   282     ri <- clientRoomA
   283     inGame <- io $ room'sM rnc gameinprogress ri
   283     inGame <- io $ room'sM rnc gameinprogress ri
   284     chans <- othersChans
   284     chans <- othersChans
   285     if inGame then
   285     if not $ inGame then
   286             mapM_ processAction [
   286             mapM_ processAction [
   287                 AnswerClients chans ["REMOVE_TEAM", teamName],
   287                 AnswerClients chans ["REMOVE_TEAM", teamName],
   288                 ModifyRoom (\r -> r{teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r})
   288                 ModifyRoom (\r -> r{teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r})
   289                 ]
   289                 ]
   290         else
   290         else