gameServer/Utils.hs
changeset 9702 27006953d901
parent 9448 04e0acfa7c2c
child 9753 9579596cf471
equal deleted inserted replaced
9700:3034605a4604 9702:27006953d901
   123 caseInsensitiveCompare a b = upperCase a == upperCase b
   123 caseInsensitiveCompare a b = upperCase a == upperCase b
   124 
   124 
   125 upperCase :: B.ByteString -> B.ByteString
   125 upperCase :: B.ByteString -> B.ByteString
   126 upperCase = UTF8.fromString . map Char.toUpper . UTF8.toString
   126 upperCase = UTF8.fromString . map Char.toUpper . UTF8.toString
   127 
   127 
   128 roomInfo :: B.ByteString -> RoomInfo -> [B.ByteString]
   128 roomInfo :: Word16 -> B.ByteString -> RoomInfo -> [B.ByteString]
   129 roomInfo n r = [
   129 roomInfo p n r 
       
   130     | p < 46 = [
   130         showB $ isJust $ gameInfo r,
   131         showB $ isJust $ gameInfo r,
   131         name r,
   132         name r,
   132         showB $ playersIn r,
   133         showB $ playersIn r,
   133         showB $ length $ teams r,
   134         showB $ length $ teams r,
   134         n,
   135         n,
   135         Map.findWithDefault "+rnd+" "MAP" (mapParams r),
   136         Map.findWithDefault "+rnd+" "MAP" (mapParams r),
   136         head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
   137         head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
   137         head (Map.findWithDefault ["Default"] "AMMO" (params r))
   138         head (Map.findWithDefault ["Default"] "AMMO" (params r))
   138         ]
   139         ]
   139 
   140     | otherwise = [
       
   141         showB $ isJust $ gameInfo r,
       
   142         name r,
       
   143         showB $ playersIn r,
       
   144         showB $ length $ teams r,
       
   145         n,
       
   146         Map.findWithDefault "+rnd+" "MAP" (mapParams r),
       
   147         head (Map.findWithDefault ["Normal"] "SCRIPT" (params r)),
       
   148         head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
       
   149         head (Map.findWithDefault ["Default"] "AMMO" (params r))
       
   150         ]
   140 
   151 
   141 answerFullConfigParams ::
   152 answerFullConfigParams ::
   142             ClientInfo
   153             ClientInfo
   143             -> Map.Map B.ByteString B.ByteString
   154             -> Map.Map B.ByteString B.ByteString
   144             -> Map.Map B.ByteString [B.ByteString]
   155             -> Map.Map B.ByteString [B.ByteString]