gameServer/Actions.hs
changeset 7123 9fe1c4091dd1
parent 7120 9257cf8e7af2
child 7124 cfee05712896
--- a/gameServer/Actions.hs	Tue May 22 11:19:32 2012 +0200
+++ b/gameServer/Actions.hs	Wed May 23 22:46:37 2012 +0200
@@ -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
                 ]