gameServer/HWProtoCore.hs
changeset 1879 bb114339eb4e
parent 1862 7f303aa066da
child 1928 9bf8f4f30d6b
equal deleted inserted replaced
1878:b3b277d2b891 1879:bb114339eb4e
    14 handleCmd, handleCmd_loggedin :: CmdHandler
    14 handleCmd, handleCmd_loggedin :: CmdHandler
    15 
    15 
    16 handleCmd clID _ _ ["PING"] = [AnswerThisClient ["PONG"]]
    16 handleCmd clID _ _ ["PING"] = [AnswerThisClient ["PONG"]]
    17 
    17 
    18 handleCmd clID clients rooms ("QUIT" : xs) =
    18 handleCmd clID clients rooms ("QUIT" : xs) =
    19 	(if isMaster client then [RemoveRoom] else removeClientTeams)
    19 	(if isMaster client then [RemoveRoom] else [RemoveClientTeams clID])
    20 	++ [ByeClient msg]
    20 	++ [ByeClient msg]
    21 	where
    21 	where
    22 		client = clients IntMap.! clID
    22 		client = clients IntMap.! clID
    23 		clientNick = nick client
    23 		clientNick = nick client
    24 		msg = if not $ null xs then head xs else ""
    24 		msg = if not $ null xs then head xs else ""
    25 		room = rooms IntMap.! (roomID client)
       
    26 		clientTeams = filter (\t -> teamowner t == nick client) $ teams room
       
    27 		removeClientTeams = map (RemoveTeam . teamname) clientTeams
       
    28 
    25 
    29 
    26 
    30 handleCmd clID clients rooms cmd =
    27 handleCmd clID clients rooms cmd =
    31 	if not $ logonPassed client then
    28 	if not $ logonPassed client then
    32 		handleCmd_NotEntered clID clients rooms cmd
    29 		handleCmd_NotEntered clID clients rooms cmd