- Restore pre-
r9257cf8e7af2 behavior
- Get rid of leftTeams, send REMOVE_TEAM immediately instead
--- 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
--- a/gameServer/CoreTypes.hs Wed May 23 16:51:37 2012 -0400
+++ b/gameServer/CoreTypes.hs Fri May 25 00:06:42 2012 +0400
@@ -67,7 +67,6 @@
GameInfo
{
roundMsgs :: Seq B.ByteString,
- leftTeams :: [B.ByteString],
teamsAtStart :: [TeamInfo],
teamsInGameNumber :: Int,
allPlayersHaveRegisteredAccounts :: Bool,
@@ -79,7 +78,6 @@
newGameInfo =
GameInfo
Data.Sequence.empty
- []
data RoomInfo =
RoomInfo