Display error when using /maxteams if not room master
authorWuzzy <Wuzzy2@mail.ru>
Sat, 01 Sep 2018 00:05:55 +0200
changeset 13734 f4c8c6a174e8
parent 13733 3106d630d6b5
child 13735 5f62417a7d84
Display error when using /maxteams if not room master
gameServer/HWProtoInRoomState.hs
--- a/gameServer/HWProtoInRoomState.hs	Fri Aug 31 23:49:32 2018 +0200
+++ b/gameServer/HWProtoInRoomState.hs	Sat Sep 01 00:05:55 2018 +0200
@@ -407,10 +407,12 @@
     return [AnswerClients s ["CHAT", n, B.unwords $ "/rnd" : rs], Random s rs]
 
 
-handleCmd_inRoom ["MAXTEAMS", n] = roomAdminOnly $ do
+handleCmd_inRoom ["MAXTEAMS", n] = do
     cl <- thisClient
     let m = readInt_ n
-    if m < 2 || m > cMaxTeams then
+    if not $ isMaster cl then
+        return [Warning $ loc "You're not the room master!"]
+    else if m < 2 || m > cMaxTeams then
         return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "/maxteams: specify number from 2 to 8"]]
     else
         return [ModifyRoom (\r -> r{teamsNumberLimit = m})]