Merge unc0rr's rearranging of MAP/MAPGEN messages, also his suggested increase of char limit to 20000 and addition of the "c" game message
authornemo
Sun, 19 Dec 2010 13:33:45 -0500
changeset 4570 fa19f0579083
parent 4568 f85243bf890e
child 4572 087fdb85e2ef
Merge unc0rr's rearranging of MAP/MAPGEN messages, also his suggested increase of char limit to 20000 and addition of the "c" game message
gameServer/ClientIO.hs
gameServer/HWProtoLobbyState.hs
gameServer/Utils.hs
--- a/gameServer/ClientIO.hs	Sun Dec 19 13:31:55 2010 -0500
+++ b/gameServer/ClientIO.hs	Sun Dec 19 13:33:45 2010 -0500
@@ -14,7 +14,7 @@
 listenLoop :: Handle -> Int -> [String] -> Chan CoreMessage -> Int -> IO ()
 listenLoop handle linesNumber buf chan clientID = do
     str <- liftM BUTF8.toString $ B.hGetLine handle
-    if (linesNumber > 50) || (length str > 450) then
+    if (linesNumber > 50) || (length str > 20000) then
         writeChan chan $ ClientMessage (clientID, ["QUIT", "Protocol violation"])
         else
         if str == "" then do
--- a/gameServer/HWProtoLobbyState.hs	Sun Dec 19 13:31:55 2010 -0500
+++ b/gameServer/HWProtoLobbyState.hs	Sun Dec 19 13:33:45 2010 -0500
@@ -101,8 +101,8 @@
 
         toAnswer (paramName, paramStrs) = AnswerThisClient $ "CFG" : paramName : paramStrs
         
-        answerFullConfig = map toAnswer (leftConfigPart ++ rightConfigPart)
-        (leftConfigPart, rightConfigPart) = partition (\(p, _) -> p /= "MAP") (Map.toList $ params jRoom)
+        answerFullConfig = map toAnswer ((Data.List.reverse . Data.List.sort $ leftConfigPart) ++ rightConfigPart)
+        (leftConfigPart, rightConfigPart) = partition (\(p, _) -> p == "MAP" || p == "MAPGEN") (Map.toList $ params jRoom)
 
         watchRound = if not $ gameinprogress jRoom then
                     []
--- a/gameServer/Utils.hs	Sun Dec 19 13:31:55 2010 -0500
+++ b/gameServer/Utils.hs	Sun Dec 19 13:33:45 2010 -0500
@@ -46,7 +46,7 @@
         check Nothing = (False, False)
         check (Just (m:ms)) = (m `Set.member` legalMessages, m == '+')
         check _ = (False, False)
-        legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghb12345" ++ slotMessages
+        legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghbc12345" ++ slotMessages
         slotMessages = "\128\129\130\131\132\133\134\135\136\137\138"
 
 maybeRead :: Read a => String -> Maybe a