gameServer/HWProtoCore.hs
changeset 1814 e5391d901cff
parent 1811 1b9e33623b7e
child 1841 fba7210b438b
equal deleted inserted replaced
1813:cfe1481e0247 1814:e5391d901cff
    11 
    11 
    12 handleCmd:: CmdHandler
    12 handleCmd:: CmdHandler
    13 
    13 
    14 handleCmd clID _ _ ["PING"] = [AnswerThisClient ["PONG"]]
    14 handleCmd clID _ _ ["PING"] = [AnswerThisClient ["PONG"]]
    15 
    15 
    16 handleCmd clID clients _ ("QUIT" : xs) =
    16 handleCmd clID clients rooms ("QUIT" : xs) =
    17 	(if isMaster client then [RemoveRoom] else [])
    17 	(if isMaster client then [RemoveRoom] else removeClientTeams)
    18 	++ [ByeClient msg]
    18 	++ [ByeClient msg]
    19 	where
    19 	where
    20 		client = clients IntMap.! clID
    20 		client = clients IntMap.! clID
    21 		clientNick = nick client
    21 		clientNick = nick client
    22 		msg = if not $ null xs then head xs else ""
    22 		msg = if not $ null xs then head xs else ""
    23 
    23 		room = rooms IntMap.! (roomID client)
       
    24 		clientTeams = filter (\t -> teamowner t == nick client) $ teams room
       
    25 		removeClientTeams = map (RemoveTeam . teamname) clientTeams
    24 
    26 
    25 handleCmd clID clients rooms cmd =
    27 handleCmd clID clients rooms cmd =
    26 	if null (nick client) || clientProto client == 0 then
    28 	if null (nick client) || clientProto client == 0 then
    27 		handleCmd_NotEntered clID clients rooms cmd
    29 		handleCmd_NotEntered clID clients rooms cmd
    28 	else if roomID client == 0 then
    30 	else if roomID client == 0 then