Fix ready players accounting
authorunc0rr
Sat, 21 Feb 2009 19:59:03 +0000
changeset 1823 1938ef375350
parent 1822 be7105bc727d
child 1824 fbe1fa777d68
Fix ready players accounting
gameServer/Actions.hs
--- a/gameServer/Actions.hs	Sat Feb 21 14:50:39 2009 +0000
+++ b/gameServer/Actions.hs	Sat Feb 21 19:59:03 2009 +0000
@@ -96,7 +96,11 @@
 			0,
 			serverInfo,
 			delete clID clients,
-			adjust (\r -> r{playersIDs = IntSet.delete clID (playersIDs r), playersIn = (playersIn r) - 1}) rID rooms
+			adjust (\r -> r{
+					playersIDs = IntSet.delete clID (playersIDs r),
+					playersIn = (playersIn r) - 1,
+					readyPlayers = if isReady client then readyPlayers r - 1 else readyPlayers r
+					}) rID rooms
 			)
 	where
 		client = clients ! clID
@@ -152,7 +156,11 @@
 		clID,
 		serverInfo,
 		adjust (\cl -> cl{roomID = 0}) clID clients,
-		adjust (\r -> r{playersIDs = IntSet.delete clID (playersIDs r), playersIn = (playersIn r) - 1}) rID $
+		adjust (\r -> r{
+				playersIDs = IntSet.delete clID (playersIDs r),
+				playersIn = (playersIn r) - 1,
+				readyPlayers = if isReady client then readyPlayers r - 1 else readyPlayers r
+				}) rID $
 			adjust (\r -> r{playersIDs = IntSet.insert clID (playersIDs r)}) 0 rooms
 		)
 	where