Mark team for deletion when letting others know it has left during game. Should help with quitters problem.
--- 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
]