gameServer/HWProtoInRoomState.hs
changeset 6012 6bac93097da3
parent 5996 2c72fe81dd37
child 6068 e18713ecf1e0
--- a/gameServer/HWProtoInRoomState.hs	Sat Sep 24 22:16:49 2011 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Sat Sep 24 21:14:51 2011 +0400
@@ -166,16 +166,19 @@
         ]
 
 handleCmd_inRoom ["START_GAME"] = do
+    (ci, rnc) <- ask
     cl <- thisClient
     rm <- thisRoom
     chans <- roomClientsChans
+    
+    let allPlayersRegistered = all ((<) 0 . B.length . webPassword . client rnc . teamownerId) $ teams rm
 
     if isMaster cl && playersIn rm == readyPlayers rm && not (isJust $ gameInfo rm) then
         if enoughClans rm then
             return [
                 ModifyRoom
                     (\r -> r{
-                        gameInfo = Just $ newGameInfo False
+                        gameInfo = Just $ newGameInfo allPlayersRegistered
                         }
                     ),
                 AnswerClients chans ["RUN_GAME"]
@@ -207,8 +210,9 @@
     chans <- roomClientsChans
 
     if isMaster cl && (isJust $ gameInfo rm) then
-        return $ 
-            ModifyRoom
+        return $
+            SaveReplay
+            : ModifyRoom
                 (\r -> r{
                     gameInfo = Nothing,
                     readyPlayers = 0