gameServer/Utils.hs
branchsdl2transition
changeset 9798 f2b18754742f
parent 9753 9579596cf471
child 9837 fa94ee96f006
--- a/gameServer/Utils.hs	Sat Dec 14 21:16:20 2013 +0400
+++ b/gameServer/Utils.hs	Tue Dec 17 00:02:52 2013 +0400
@@ -125,8 +125,9 @@
 upperCase :: B.ByteString -> B.ByteString
 upperCase = UTF8.fromString . map Char.toUpper . UTF8.toString
 
-roomInfo :: B.ByteString -> RoomInfo -> [B.ByteString]
-roomInfo n r = [
+roomInfo :: Word16 -> B.ByteString -> RoomInfo -> [B.ByteString]
+roomInfo p n r 
+    | p < 46 = [
         showB $ isJust $ gameInfo r,
         name r,
         showB $ playersIn r,
@@ -136,7 +137,17 @@
         head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
         head (Map.findWithDefault ["Default"] "AMMO" (params r))
         ]
-
+    | otherwise = [
+        showB $ isJust $ gameInfo r,
+        name r,
+        showB $ playersIn r,
+        showB $ length $ teams r,
+        n,
+        Map.findWithDefault "+rnd+" "MAP" (mapParams r),
+        head (Map.findWithDefault ["Normal"] "SCRIPT" (params r)),
+        head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
+        head (Map.findWithDefault ["Default"] "AMMO" (params r))
+        ]
 
 answerFullConfigParams ::
             ClientInfo
@@ -169,3 +180,6 @@
 
 loc :: B.ByteString -> B.ByteString
 loc = id
+
+maybeNick :: Maybe ClientInfo -> B.ByteString
+maybeNick = fromMaybe "[empty]" . liftM nick