gameServer/Actions.hs
changeset 1827 3bb5e22b7f9a
parent 1823 1938ef375350
child 1834 71cb978dc85f
--- a/gameServer/Actions.hs	Mon Feb 23 15:58:08 2009 +0000
+++ b/gameServer/Actions.hs	Mon Feb 23 18:35:32 2009 +0000
@@ -159,7 +159,7 @@
 		adjust (\r -> r{
 				playersIDs = IntSet.delete clID (playersIDs r),
 				playersIn = (playersIn r) - 1,
-				readyPlayers = if isReady client then readyPlayers r - 1 else readyPlayers r
+				readyPlayers = if isReady client then (readyPlayers r) - 1 else readyPlayers r
 				}) rID $
 			adjust (\r -> r{playersIDs = IntSet.insert clID (playersIDs r)}) 0 rooms
 		)
@@ -195,7 +195,7 @@
 	processAction (clID, serverInfo, clients, rooms) $ AnswerOthersInRoom ["ROOMABANDONED", name room]
 	return (clID,
 		serverInfo,
-		Data.IntMap.map (\cl -> if roomID cl == rID then cl{roomID = 0, isMaster = False} else cl) clients,
+		Data.IntMap.map (\cl -> if roomID cl == rID then cl{roomID = 0, isMaster = False, isReady = False} else cl) clients,
 		delete rID $ adjust (\r -> r{playersIDs = IntSet.union (playersIDs room) (playersIDs r)}) 0 rooms
 		)
 	where
@@ -209,7 +209,7 @@
 	return (clID,
 		serverInfo,
 		Data.IntMap.map (\cl -> if roomID cl == rID then cl{isReady = False} else cl) clients,
-		rooms)
+		adjust (\r -> r{readyPlayers = 0}) rID rooms)
 	where
 		room = rooms ! rID
 		rID = roomID client