gameServer/Actions.hs
changeset 7921 6b074de32bea
parent 7898 ba735701ce7f
child 7924 351f970c60e1
equal deleted inserted replaced
7919:c7d258a4358e 7921:6b074de32bea
    60     | ModifyClient2 ClientIndex (ClientInfo -> ClientInfo)
    60     | ModifyClient2 ClientIndex (ClientInfo -> ClientInfo)
    61     | ModifyRoomClients (ClientInfo -> ClientInfo)
    61     | ModifyRoomClients (ClientInfo -> ClientInfo)
    62     | ModifyRoom (RoomInfo -> RoomInfo)
    62     | ModifyRoom (RoomInfo -> RoomInfo)
    63     | ModifyServerInfo (ServerInfo -> ServerInfo)
    63     | ModifyServerInfo (ServerInfo -> ServerInfo)
    64     | AddRoom B.ByteString B.ByteString
    64     | AddRoom B.ByteString B.ByteString
       
    65     | SendUpdateOnThisRoom
    65     | CheckRegistered
    66     | CheckRegistered
    66     | ClearAccountsCache
    67     | ClearAccountsCache
    67     | ProcessAccountInfo AccountInfo
    68     | ProcessAccountInfo AccountInfo
    68     | AddClient ClientInfo
    69     | AddClient ClientInfo
    69     | DeleteClient ClientIndex
    70     | DeleteClient ClientIndex
   317         ]
   318         ]
   318 
   319 
   319     io $ removeRoom rnc ri
   320     io $ removeRoom rnc ri
   320 
   321 
   321 
   322 
       
   323 processAction SendUpdateOnThisRoom = do
       
   324     Just clId <- gets clientIndex
       
   325     proto <- client's clientProto
       
   326     rnc <- gets roomsClients
       
   327     ri <- io $ clientRoomM rnc clId
       
   328     rm <- io $ room'sM rnc id ri
       
   329     chans <- liftM (map sendChan) $! sameProtoClientsS proto
       
   330     processAction $ AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo (name rm) rm)
       
   331 
       
   332 
   322 processAction UnreadyRoomClients = do
   333 processAction UnreadyRoomClients = do
   323     ri <- clientRoomA
   334     ri <- clientRoomA
   324     roomPlayers <- roomClientsS ri
   335     roomPlayers <- roomClientsS ri
   325     pr <- client's clientProto
   336     pr <- client's clientProto
   326     mapM_ processAction [
   337     mapM_ processAction [
   346                 gameInfo = Nothing,
   357                 gameInfo = Nothing,
   347                 readyPlayers = 0
   358                 readyPlayers = 0
   348                 }
   359                 }
   349             )
   360             )
   350         : UnreadyRoomClients
   361         : UnreadyRoomClients
       
   362         : SendUpdateOnThisRoom
   351         : answerRemovedTeams
   363         : answerRemovedTeams
   352 
   364 
   353 
   365 
   354 processAction (SendTeamRemovalMessage teamName) = do
   366 processAction (SendTeamRemovalMessage teamName) = do
   355     chans <- othersChans
   367     chans <- othersChans