gameServer/HWProtoInRoomState.hs
changeset 3655 1ae653467897
parent 3579 f5d28402ca1d
child 4242 5e3c5fe2cb14
--- a/gameServer/HWProtoInRoomState.hs	Mon Jul 19 23:00:10 2010 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Mon Jul 19 23:10:33 2010 +0400
@@ -195,26 +195,27 @@
     where
         (isLegal, isKeepAlive) = checkNetCmd msg
 
-{-
-handleCmd_inRoom clID clients rooms ["ROUNDFINISHED"] =
-    if isMaster client then
-        [ModifyRoom
+
+handleCmd_inRoom ["ROUNDFINISHED"] = do
+    cl <- thisClient
+    r <- thisRoom
+    chans <- roomClientsChans
+
+    if isMaster cl && (gameinprogress r) then
+        return $ (ModifyRoom
                 (\r -> r{
                     gameinprogress = False,
                     readyPlayers = 0,
                     roundMsgs = empty,
                     leftTeams = [],
                     teamsAtStart = []}
-                ),
-        UnreadyRoomClients
-        ] ++ answerRemovedTeams
-    else
-        []
+                ))
+            : UnreadyRoomClients
+            : answerRemovedTeams chans r
+        else
+        return []
     where
-        client = clients IntMap.! clID
-        room = rooms IntMap.! (roomID client)
-        answerRemovedTeams = map (\t -> AnswerThisRoom ["REMOVE_TEAM", t]) $ leftTeams room
--}
+        answerRemovedTeams chans = map (\t -> AnswerClients chans ["REMOVE_TEAM", t]) . leftTeams
 
 handleCmd_inRoom ["TOGGLE_RESTRICT_JOINS"] = do
     cl <- thisClient