gameServer/HWProtoInRoomState.hs
changeset 10882 ed7717f659ae
parent 10881 941b5ab9e5a6
child 10884 7b76811fb689
--- a/gameServer/HWProtoInRoomState.hs	Tue Mar 31 23:01:53 2015 +0300
+++ b/gameServer/HWProtoInRoomState.hs	Tue Mar 31 23:14:09 2015 +0300
@@ -125,7 +125,7 @@
                     defaultHedgehogsNumber rm
         let newTeam = clNick `seq` TeamInfo clNick tName teamColor grave fort voicepack flag isRegistered dif hhNum (hhsList hhsInfo)
         return $
-            if not . null . drop (maxTeams rm - 1) $ roomTeams then
+            if not . null . drop (teamsNumberLimit rm) $ roomTeams then
                 [Warning $ loc "too many teams"]
             else if canAddNumber roomTeams <= 0 then
                 [Warning $ loc "too many hedgehogs"]
@@ -389,6 +389,15 @@
     s <- roomClientsChans
     return [AnswerClients s ["CHAT", n, B.unwords $ "/rnd" : rs], Random s rs]
 
+
+handleCmd_inRoom ["MAXTEAMS", n] = roomAdminOnly $ do
+    cl <- thisClient
+    let m = readInt_ n
+    if m < 2 || m > 8 then
+        return [AnswerClients [sendChan cl] ["CHAT", "[server]", loc "/maxteams: specify number from 2 to 8"]]
+    else
+        return [ModifyRoom (\r -> r{teamsNumberLimit = m})]
+
 handleCmd_inRoom ["FIX"] = serverAdminOnly $
     return [ModifyRoom (\r -> r{isSpecial = True})]