gameServer/Actions.hs
changeset 7124 cfee05712896
parent 7120 9257cf8e7af2
child 7126 8daa5c8e84c0
--- a/gameServer/Actions.hs	Wed May 23 16:51:37 2012 -0400
+++ b/gameServer/Actions.hs	Fri May 25 00:06:42 2012 +0400
@@ -312,18 +312,17 @@
     ri <- clientRoomA
     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
     clNick <- client's nick
-    answerRemovedTeams <- io $ 
-         room'sM rnc (map (\t -> AnswerClients thisRoomChans ["REMOVE_TEAM", t]) . leftTeams . fromJust . gameInfo) ri
     
-    mapM_ processAction $ SaveReplay
-        : ModifyRoom
+    mapM_ processAction [
+        SaveReplay
+        , ModifyRoom
             (\r -> r{
                 gameInfo = Nothing,
                 readyPlayers = 0
                 }
             )
-        : UnreadyRoomClients
-        : answerRemovedTeams
+        , UnreadyRoomClients
+        ]
 
         
 processAction (SendTeamRemovalMessage teamName) = do
@@ -332,9 +331,8 @@
         AnswerClients chans ["EM", rmTeamMsg],
         ModifyRoom (\r -> r{
                 gameInfo = liftM (\g -> g{
-                teamsInGameNumber = teamsInGameNumber g - 1
-                , roundMsgs = roundMsgs g Seq.|> rmTeamMsg
-                , leftTeams = teamName : leftTeams g
+                    teamsInGameNumber = teamsInGameNumber g - 1
+                    , roundMsgs = roundMsgs g Seq.|> rmTeamMsg
                 }) $ gameInfo r
             })
         ]
@@ -353,16 +351,10 @@
     ri <- clientRoomA
     inGame <- io $ room'sM rnc (isJust . gameInfo) ri
     chans <- othersChans
-    if not $ inGame then
-            mapM_ processAction [
-                ModifyRoom (\r -> r{teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r})
-                , AnswerClients chans ["REMOVE_TEAM", teamName]
-                ]
-        else
-            mapM_ processAction [
-                ModifyRoom (\r -> r{teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r})
-                , SendTeamRemovalMessage teamName
-                ]
+    mapM_ processAction $ 
+        ModifyRoom (\r -> r{teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r})
+        : AnswerClients chans ["REMOVE_TEAM", teamName]
+        : [SendTeamRemovalMessage teamName | inGame]
 
 
 processAction (RemoveClientTeams clId) = do