This should work, can't test: room flags passed in room info message instead of just 'in-game' state, including 'in-game', 'restricted joins', 'registered only' and 'passworded' flags
authorunc0rr
Tue, 18 Nov 2014 00:32:39 +0300
changeset 10511 c33b2f001730
parent 10510 9329dab04490
child 10512 25021aac078e
This should work, can't test: room flags passed in room info message instead of just 'in-game' state, including 'in-game', 'restricted joins', 'registered only' and 'passworded' flags
QTfrontend/model/roomslistmodel.cpp
gameServer/HWProtoInRoomState.hs
gameServer/Utils.hs
--- a/QTfrontend/model/roomslistmodel.cpp	Mon Nov 17 15:25:24 2014 +0100
+++ b/QTfrontend/model/roomslistmodel.cpp	Tue Nov 18 00:32:39 2014 +0300
@@ -262,9 +262,10 @@
 
     result = info;
 
+    QString flags = info[StateColumn];
     // for matters of less memory usage and quicker access store
     // the boolean string as either "t" or empty
-    if (info[StateColumn].toLower() == "true")
+    if (flags.contains('g'))
         result[StateColumn] = "t";
     else
         result[StateColumn] = QString();
--- a/gameServer/HWProtoInRoomState.hs	Mon Nov 17 15:25:24 2014 +0100
+++ b/gameServer/HWProtoInRoomState.hs	Tue Nov 18 00:32:39 2014 +0300
@@ -285,7 +285,7 @@
     handleCmd_inRoom ["ROUNDFINISHED", "1"]
 
 handleCmd_inRoom ["TOGGLE_RESTRICT_JOINS"] = roomAdminOnly $
-    return [ModifyRoom (\r -> r{isRestrictedJoins = not $ isRestrictedJoins r})]
+    return [ModifyRoom (\r -> r{isRestrictedJoins = not $ isRestrictedJoins r}), SendUpdateOnThisRoom]
 
 
 handleCmd_inRoom ["TOGGLE_RESTRICT_TEAMS"] = roomAdminOnly $
@@ -293,7 +293,7 @@
 
 
 handleCmd_inRoom ["TOGGLE_REGISTERED_ONLY"] = roomAdminOnly $
-    return [ModifyRoom (\r -> r{isRegisteredOnly = not $ isRegisteredOnly r})]
+    return [ModifyRoom (\r -> r{isRegisteredOnly = not $ isRegisteredOnly r}), SendUpdateOnThisRoom]
 
 
 handleCmd_inRoom ["ROOM_NAME", newName] = roomAdminOnly $ do
--- a/gameServer/Utils.hs	Mon Nov 17 15:25:24 2014 +0100
+++ b/gameServer/Utils.hs	Tue Nov 18 00:32:39 2014 +0300
@@ -158,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,
@@ -169,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