gameServer/Utils.hs
branchqmlfrontend
changeset 10515 7705784902e1
parent 10511 c33b2f001730
child 10524 2bc0ff00e95b
--- a/gameServer/Utils.hs	Sun Nov 09 23:02:21 2014 +0300
+++ b/gameServer/Utils.hs	Tue Nov 18 23:39:30 2014 +0300
@@ -1,3 +1,21 @@
+{-
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ \-}
+
 {-# LANGUAGE OverloadedStrings #-}
 module Utils where
 
@@ -140,7 +158,7 @@
         head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
         head (Map.findWithDefault ["Default"] "AMMO" (params r))
         ]
-    | otherwise = [
+    | p < 48 = [
         showB $ isJust $ gameInfo r,
         name r,
         showB $ playersIn r,
@@ -151,6 +169,25 @@
         head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
         head (Map.findWithDefault ["Default"] "AMMO" (params r))
         ]
+    | otherwise = [
+        B.pack roomFlags,
+        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))
+        ]
+    where
+        roomFlags = concat [
+            "-"
+            , ['g' | isJust $ gameInfo r]
+            , ['p' | B.null $ password r]
+            , ['j' | isRestrictedJoins  r]
+            , ['r' | isRegisteredOnly  r]
+            ]
 
 answerFullConfigParams ::
             ClientInfo