]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Display minplayers and maxplayers in welcome message
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index b35b7f3db63b1c11717b0e919b0675c9c71d33df..eb4cb7ba87e7f2b1312210f0914417d347217b1c 100644 (file)
@@ -1423,6 +1423,8 @@ bool net_handle_ServerWelcome()
        string hostversion = ReadString();
        bool version_mismatch = ReadByte();
        bool version_check = ReadByte();
+       srv_minplayers = ReadByte();
+       srv_maxplayers = ReadByte();
        string modifications = translate_modifications(ReadString());
        string weaponarena_list = translate_weaponarena(ReadString());
        string cache_mutatormsg = ReadString();
@@ -1432,6 +1434,19 @@ bool net_handle_ServerWelcome()
 
        msg = strcat(msg, "^8\n\n", strcat(_("Gametype:"), " ^1", MapInfo_Type_ToText(gametype)), "^8\n");
 
+       if (srv_minplayers || srv_maxplayers)
+       {
+               msg = strcat(msg, "^8\n", _("This match supports"), " ^5");
+               if (srv_minplayers == srv_maxplayers)
+                       msg = strcat(msg, sprintf(_("%d players"), srv_maxplayers), "^8\n");
+               else if (srv_minplayers && srv_maxplayers)
+                       msg = strcat(msg, sprintf(_("%d to %d players"), srv_minplayers, srv_maxplayers), "^8\n");
+               else if (srv_maxplayers)
+                       msg = strcat(msg, sprintf(_("%d players maximum"), srv_maxplayers), "^8\n");
+               else
+                       msg = strcat(msg, sprintf(_("%d players minimum"), srv_minplayers), "^8\n");
+       }
+
        modifications = cons_mid(modifications, ", ", weaponarena_list);
        if(modifications != "")
                msg = strcat(msg, "^8\n", _("Active modifications:"), " ^3", modifications, "^8\n");