- Fix ping timeouts after incorrect "/vote" commands (protocol violation)
- Add "/info" command
- Add "/maxteams" command to specify desired maximum number of teams in your room
--- a/gameServer/CoreTypes.hs Tue Mar 31 23:01:53 2015 +0300
+++ b/gameServer/CoreTypes.hs Tue Mar 31 23:14:09 2015 +0300
@@ -226,6 +226,7 @@
isRegisteredOnly :: Bool,
isSpecial :: Bool,
defaultHedgehogsNumber :: Int,
+ teamsNumberLimit :: Int,
greeting :: B.ByteString,
voting :: Maybe Voting,
roomBansList :: ![B.ByteString],
@@ -250,6 +251,7 @@
False
False
4
+ 8
""
Nothing
[]
--- a/gameServer/HWProtoCore.hs Tue Mar 31 23:01:53 2015 +0300
+++ b/gameServer/HWProtoCore.hs Tue Mar 31 23:14:09 2015 +0300
@@ -71,12 +71,14 @@
h "WATCH" f = return [QueryReplay f]
h "FIX" _ = handleCmd ["FIX"]
h "UNFIX" _ = handleCmd ["UNFIX"]
- h "GREETING" msg = handleCmd ["GREETING", msg]
+ h "GREETING" msg | not $ B.null msg = handleCmd ["GREETING", msg]
h "CALLVOTE" msg | B.null msg = handleCmd ["CALLVOTE"]
| otherwise = let (c, p) = extractParameters msg in
if B.null p then handleCmd ["CALLVOTE", c] else handleCmd ["CALLVOTE", c, p]
- h "VOTE" msg = handleCmd ["VOTE", upperCase msg]
- h "FORCE" msg = handleCmd ["VOTE", upperCase msg, "FORCE"]
+ h "VOTE" msg | not $ B.null msg = handleCmd ["VOTE", upperCase msg]
+ h "FORCE" msg | not $ B.null msg = handleCmd ["VOTE", upperCase msg, "FORCE"]
+ h "MAXTEAMS" n | not $ B.null n = handleCmd ["MAXTEAMS", n]
+ h "INFO" n | not $ B.null n = handleCmd ["INFO", n]
h c p = return [Warning $ B.concat ["Unknown cmd: /", c, " ", p]]
extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b)
--- 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})]