gameServer/HWProtoCore.hs
changeset 1814 e5391d901cff
parent 1811 1b9e33623b7e
child 1841 fba7210b438b
--- a/gameServer/HWProtoCore.hs	Fri Feb 20 19:40:55 2009 +0000
+++ b/gameServer/HWProtoCore.hs	Fri Feb 20 19:46:22 2009 +0000
@@ -13,14 +13,16 @@
 
 handleCmd clID _ _ ["PING"] = [AnswerThisClient ["PONG"]]
 
-handleCmd clID clients _ ("QUIT" : xs) =
-	(if isMaster client then [RemoveRoom] else [])
+handleCmd clID clients rooms ("QUIT" : xs) =
+	(if isMaster client then [RemoveRoom] else removeClientTeams)
 	++ [ByeClient msg]
 	where
 		client = clients IntMap.! clID
 		clientNick = nick client
 		msg = if not $ null xs then head xs else ""
-
+		room = rooms IntMap.! (roomID client)
+		clientTeams = filter (\t -> teamowner t == nick client) $ teams room
+		removeClientTeams = map (RemoveTeam . teamname) clientTeams
 
 handleCmd clID clients rooms cmd =
 	if null (nick client) || clientProto client == 0 then