gameServer/Utils.hs
changeset 9109 878f06e9c484
parent 9086 77f471657230
child 9448 04e0acfa7c2c
--- a/gameServer/Utils.hs	Wed Jun 05 00:26:22 2013 +0400
+++ b/gameServer/Utils.hs	Thu Jun 06 00:28:30 2013 +0400
@@ -137,5 +137,25 @@
         head (Map.findWithDefault ["Default"] "AMMO" (params r))
         ]
 
+
+answerFullConfigParams ::
+            ClientInfo
+            -> Map.Map B.ByteString B.ByteString
+            -> Map.Map B.ByteString [B.ByteString]
+            -> [Action]
+answerFullConfigParams cl mpr pr
+        | clientProto cl < 38 = map (toAnswer cl) $
+                (reverse . map (\(a, b) -> (a, [b])) $ Map.toList mpr)
+                ++ (("SCHEME", pr Map.! "SCHEME")
+                : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr))
+
+        | otherwise = map (toAnswer cl) $
+                ("FULLMAPCONFIG", Map.elems mpr)
+                : ("SCHEME", pr Map.! "SCHEME")
+                : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr)
+    where
+        toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
+
+
 loc :: B.ByteString -> B.ByteString
 loc = id