Restore ready toggle for room admins (issue 432)
authorunc0rr
Mon, 13 May 2013 22:49:14 +0400
changeset 8983 a25e18295959
parent 8982 0c0141cf851a
child 8984 3c342826f299
Restore ready toggle for room admins (issue #432)
QTfrontend/net/newnetclient.cpp
gameServer/Actions.hs
gameServer/HWProtoInRoomState.hs
--- a/QTfrontend/net/newnetclient.cpp	Mon May 13 14:10:51 2013 -0400
+++ b/QTfrontend/net/newnetclient.cpp	Mon May 13 22:49:14 2013 +0400
@@ -425,8 +425,7 @@
                         {
                             if (nick == mynick)
                             {
-                                if (isChief && !setFlag) ToggleReady();
-                                else emit setMyReadyStatus(setFlag);
+                                emit setMyReadyStatus(setFlag);
                             }
                             m_playersModel->setFlag(nick, PlayersListModel::Ready, setFlag);
                         }
--- a/gameServer/Actions.hs	Mon May 13 14:10:51 2013 -0400
+++ b/gameServer/Actions.hs	Mon May 13 22:49:14 2013 +0400
@@ -216,12 +216,12 @@
                 , name = newRoomName
                 , isRestrictedJoins = False
                 , isRestrictedTeams = False
-                , isRegisteredOnly = False
-                , readyPlayers = if isReady newMaster then readyPlayers r else readyPlayers r + 1})
-        , ModifyClient2 newMasterId (\c -> c{isMaster = True, isReady = True})
+                , isRegisteredOnly = False}
+                )
+        , ModifyClient2 newMasterId (\c -> c{isMaster = True})
         , AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"]
         , AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", oldMaster]
-        , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+hr", nick newMaster]
+        , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+h", nick newMaster]
         ]
 
     newRoom' <- io $ room'sM rnc id ri
--- a/gameServer/HWProtoInRoomState.hs	Mon May 13 14:10:51 2013 -0400
+++ b/gameServer/HWProtoInRoomState.hs	Mon May 13 22:49:14 2013 +0400
@@ -169,17 +169,15 @@
 handleCmd_inRoom ["TOGGLE_READY"] = do
     cl <- thisClient
     chans <- roomClientsChans
-    if isMaster cl then
-        return []
-        else
-        return [
-            ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)}),
-            ModifyClient (\c -> c{isReady = not $ isReady cl}),
-            AnswerClients chans $ if clientProto cl < 38 then
-                    [if isReady cl then "NOT_READY" else "READY", nick cl]
-                    else
-                    ["CLIENT_FLAGS", if isReady cl then "-r" else "+r", nick cl]
-            ]
+
+    return [
+        ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)}),
+        ModifyClient (\c -> c{isReady = not $ isReady cl}),
+        AnswerClients chans $ if clientProto cl < 38 then
+                [if isReady cl then "NOT_READY" else "READY", nick cl]
+                else
+                ["CLIENT_FLAGS", if isReady cl then "-r" else "+r", nick cl]
+        ]
 
 
 handleCmd_inRoom ["START_GAME"] = do