gameServer/Utils.hs
changeset 15900 fc3cb23fd26f
parent 15721 27eb5abd5058
child 15901 4c58b320056c
--- a/gameServer/Utils.hs	Fri Sep 23 12:47:47 2022 -0400
+++ b/gameServer/Utils.hs	Tue Sep 27 14:59:03 2022 +0300
@@ -158,11 +158,16 @@
 upperCase :: B.ByteString -> B.ByteString
 upperCase = UTF8.fromString . map Char.toUpper . UTF8.toString
 
+roomNameByProto :: B.ByteString -> Word16 -> Word16 -> B.ByteString
+roomNameByProto roomName roomProto clientProto
+    | clientProto < 60 && roomProto /= clientProto = B.concat [B.pack "[v", protoNumber2ver roomProto, B.pack "] ", roomName]
+    | otherwise = roomName
+
 roomInfo :: Word16 -> B.ByteString -> RoomInfo -> [B.ByteString]
 roomInfo p n r
     | p < 46 = [
         showB $ isJust $ gameInfo r,
-        name r,
+        roomNameByProto (name r) (roomProto r) p,
         showB $ playersIn r,
         showB $ length $ teams r,
         n,
@@ -172,7 +177,18 @@
         ]
     | p < 48 = [
         showB $ isJust $ gameInfo r,
-        name r,
+        roomNameByProto (name r) (roomProto r) p,
+        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))
+        ]
+    | p < 60 = [
+        B.pack roomFlags,
+        roomNameByProto (name r) (roomProto r) p,
         showB $ playersIn r,
         showB $ length $ teams r,
         n,
@@ -190,7 +206,8 @@
         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))
+        head (Map.findWithDefault ["Default"] "AMMO" (params r)),
+        showB $ roomProto r
         ]
     where
         roomFlags = concat [