gameServer/HWProtoInRoomState.hs
changeset 6756 344d32bb1328
parent 6753 e95b1f62d0de
child 6758 26bf919aeb57
--- a/gameServer/HWProtoInRoomState.hs	Wed Feb 29 18:30:37 2012 -0500
+++ b/gameServer/HWProtoInRoomState.hs	Thu Mar 01 23:35:13 2012 +0400
@@ -179,7 +179,7 @@
             return [
                 ModifyRoom
                     (\r -> r{
-                        gameInfo = Just $ newGameInfo (teams rm) allPlayersRegistered (mapParams rm) (params rm)
+                        gameInfo = Just $ newGameInfo (teams rm) (length $ teams rm) allPlayersRegistered (mapParams rm) (params rm)
                         }
                     ),
                 AnswerClients chans ["RUN_GAME"]
@@ -211,9 +211,10 @@
     rm <- thisRoom
     chans <- roomClientsChans
     let clTeams = map teamname . filter (\t -> teamowner t == nick cl) . teams $ rm
+    let isLastPlayer = (teamsInGameNumber . fromJust . gameInfo $ rm) == length clTeams
 
     if isJust $ gameInfo rm then
-        if isMaster cl && isCorrect then
+        if (isMaster cl && isCorrect) || isLastPlayer then
             return $
                 SaveReplay
                 : ModifyRoom