- Restrict game config changes in special rooms
authorunc0rr
Mon, 09 Dec 2013 23:32:57 +0400
changeset 9770 5706b637bae2
parent 9769 5814e0c47c99
child 9771 6fb8dafe57f7
- Restrict game config changes in special rooms - /unfix command
gameServer/HWProtoCore.hs
gameServer/HWProtoInRoomState.hs
--- a/gameServer/HWProtoCore.hs	Mon Dec 09 10:59:38 2013 -0500
+++ b/gameServer/HWProtoCore.hs	Mon Dec 09 23:32:57 2013 +0400
@@ -52,6 +52,7 @@
             return [AnswerClients chans ["CHAT", "[global notice]", p] | isAdministrator cl]
         h "WATCH" f = return [QueryReplay f]
         h "FIX" _ = handleCmd ["FIX"]
+        h "UNFIX" _ = handleCmd ["UNFIX"]
         h c p = return [Warning $ B.concat ["Unknown cmd: /", c, p]]
 
 handleCmd cmd = do
--- a/gameServer/HWProtoInRoomState.hs	Mon Dec 09 10:59:38 2013 -0500
+++ b/gameServer/HWProtoInRoomState.hs	Mon Dec 09 23:32:57 2013 +0400
@@ -31,7 +31,11 @@
     | otherwise = do
         chans <- roomOthersChans
         cl <- thisClient
-        if isMaster cl then
+        rm <- thisRoom
+
+        if isSpecial rm then
+            return [Warning $ loc "Restricted"]
+        else if isMaster cl then
            return [
                 ModifyRoom f,
                 AnswerClients chans ("CFG" : paramName : paramStrs)]
@@ -291,7 +295,7 @@
         if illegalName newName then 
             [Warning $ loc "Illegal room name"]
         else
-        if isSpecial rm then 
+        if isSpecial rm then
             [Warning $ loc "Restricted"]
         else
         if isJust $ find (\r -> newName == name r) rs then
@@ -370,6 +374,10 @@
     cl <- thisClient
     return [ModifyRoom (\r -> r{isSpecial = True}) | isAdministrator cl]
 
+handleCmd_inRoom ["UNFIX"] = do
+    cl <- thisClient
+    return [ModifyRoom (\r -> r{isSpecial = False}) | isAdministrator cl]
+
 
 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17)