--- a/gameServer/Actions.hs Tue May 22 09:25:03 2012 +0200
+++ b/gameServer/Actions.hs Fri May 25 08:42:26 2012 +0200
@@ -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,8 +331,8 @@
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
}) $ gameInfo r
})
]
@@ -352,21 +351,10 @@
ri <- clientRoomA
inGame <- io $ room'sM rnc (isJust . gameInfo) ri
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})
- ]
- 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
- })
- ]
+ 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