gameServer/Actions.hs
changeset 1862 7f303aa066da
parent 1847 2178c0fc838c
child 1866 36aa0ca6e8af
equal deleted inserted replaced
1861:98de5dc5fda7 1862:7f303aa066da
    25 	| UnreadyRoomClients
    25 	| UnreadyRoomClients
    26 	| MoveToLobby
    26 	| MoveToLobby
    27 	| ProtocolError String
    27 	| ProtocolError String
    28 	| Warning String
    28 	| Warning String
    29 	| ByeClient String
    29 	| ByeClient String
       
    30 	| KickClient Int -- clID
    30 	| ModifyClient (ClientInfo -> ClientInfo)
    31 	| ModifyClient (ClientInfo -> ClientInfo)
    31 	| ModifyRoom (RoomInfo -> RoomInfo)
    32 	| ModifyRoom (RoomInfo -> RoomInfo)
    32 	| AddRoom String String
    33 	| AddRoom String String
    33 	| CheckRegistered
    34 	| CheckRegistered
    34 	| ProcessAccountInfo AccountInfo
    35 	| ProcessAccountInfo AccountInfo
    35 	| Dump
    36 	| Dump
    36 
    37 
    37 type CmdHandler = Int -> Clients -> Rooms -> [String] -> [Action]
    38 type CmdHandler = Int -> Clients -> Rooms -> [String] -> [Action]
    38 
    39 
       
    40 replaceID a (b, c, d, e) = (a, c, d, e)
    39 
    41 
    40 processAction :: (Int, ServerInfo, Clients, Rooms) -> Action -> IO (Int, ServerInfo, Clients, Rooms)
    42 processAction :: (Int, ServerInfo, Clients, Rooms) -> Action -> IO (Int, ServerInfo, Clients, Rooms)
    41 
    43 
    42 
    44 
    43 processAction (clID, serverInfo, clients, rooms) (AnswerThisClient msg) = do
    45 processAction (clID, serverInfo, clients, rooms) (AnswerThisClient msg) = do
   279 					[AnswerThisClient (["LOBBY:JOINED"] ++ lobbyNicks)]
   281 					[AnswerThisClient (["LOBBY:JOINED"] ++ lobbyNicks)]
   280 				else
   282 				else
   281 					[]
   283 					[]
   282 
   284 
   283 
   285 
       
   286 processAction (clID, serverInfo, clients, rooms) (KickClient kickID) = do
       
   287 	liftM2 replaceID (return clID) (processAction (kickID, serverInfo, clients, rooms) $ ByeClient "Kicked")