gameServer/Actions.hs
changeset 7120 9257cf8e7af2
parent 6809 5c78efca08a4
child 7124 cfee05712896
--- a/gameServer/Actions.hs	Wed May 23 23:24:03 2012 +0400
+++ b/gameServer/Actions.hs	Wed May 23 23:30:50 2012 +0400
@@ -332,8 +332,9 @@
         AnswerClients chans ["EM", rmTeamMsg],
         ModifyRoom (\r -> r{
                 gameInfo = liftM (\g -> g{
-                teamsInGameNumber = teamsInGameNumber g - 1,
-                roundMsgs = roundMsgs g Seq.|> rmTeamMsg
+                teamsInGameNumber = teamsInGameNumber g - 1
+                , roundMsgs = roundMsgs g Seq.|> rmTeamMsg
+                , leftTeams = teamName : leftTeams g
                 }) $ gameInfo r
             })
         ]
@@ -354,18 +355,13 @@
     chans <- othersChans
     if not $ inGame then
             mapM_ processAction [
-                AnswerClients chans ["REMOVE_TEAM", teamName],
                 ModifyRoom (\r -> r{teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r})
+                , AnswerClients chans ["REMOVE_TEAM", teamName]
                 ]
         else
             mapM_ processAction [
-                SendTeamRemovalMessage teamName,
-                ModifyRoom (\r -> r{
-                    teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r,
-                        gameInfo = liftM (\g -> g{
-                        leftTeams = teamName : leftTeams g
-                        }) $ gameInfo r
-                    })
+                ModifyRoom (\r -> r{teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r})
+                , SendTeamRemovalMessage teamName
                 ]