gameServer/Actions.hs
changeset 5996 2c72fe81dd37
parent 5426 109e9b5761c2
child 6012 6bac93097da3
--- a/gameServer/Actions.hs	Fri Sep 23 09:58:41 2011 +0200
+++ b/gameServer/Actions.hs	Sat Sep 24 00:00:57 2011 +0400
@@ -17,10 +17,10 @@
 import Data.Unique
 import Control.Arrow
 import Control.Exception
-import OfficialServer.GameReplayStore
 import System.Process
 import Network.Socket
 -----------------------------
+import OfficialServer.GameReplayStore
 import CoreTypes
 import Utils
 import ClientIO
@@ -206,7 +206,7 @@
     (Just ci) <- gets clientIndex
     ri <- clientRoomA
     rnc <- gets roomsClients
-    (gameProgress, playersNum) <- io $ room'sM rnc (gameinprogress &&& playersIn) ri
+    (gameProgress, playersNum) <- io $ room'sM rnc ((isJust . gameInfo) &&& playersIn) ri
     ready <- client's isReady
     master <- client's isMaster
 --    client <- client's id
@@ -298,7 +298,7 @@
 processAction (RemoveTeam teamName) = do
     rnc <- gets roomsClients
     ri <- clientRoomA
-    inGame <- io $ room'sM rnc gameinprogress ri
+    inGame <- io $ room'sM rnc (isJust . gameInfo) ri
     chans <- othersChans
     if not $ inGame then
             mapM_ processAction [
@@ -310,8 +310,10 @@
                 AnswerClients chans ["EM", rmTeamMsg],
                 ModifyRoom (\r -> r{
                     teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r,
-                    leftTeams = teamName : leftTeams r,
-                    roundMsgs = roundMsgs r Seq.|> rmTeamMsg
+                        gameInfo = liftM (\g -> g{
+                        leftTeams = teamName : leftTeams g,
+                        roundMsgs = roundMsgs g Seq.|> rmTeamMsg
+                        }) $ gameInfo r
                     })
                 ]
     where