shithub: choc

Download patch

ref: 6a51ab4fdfcb3a606310cbc1c26e3a81bab510be
parent: 58006edc22d91b3a805ee8a1636e37de671ef1a0
author: Simon Howard <fraggle@soulsphere.org>
date: Sun Oct 22 14:54:50 EDT 2017

setup: Tweak server list interface.

When finding a server to join it helps to know if other players are
already connected. So include a player count, but because of the limited
screen space, only if there already are players. Also fix the
capitalization of the word "Internet".

This fixes #907. Thanks to @JNechaevsky for the report.

--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -933,9 +933,22 @@
     }
 
     M_snprintf(ping_time_str, sizeof(ping_time_str), "%ims", ping_time);
-    M_StringCopy(description, querydata->description,
-                 sizeof(description));
 
+    // Build description from server name field. Because there is limited
+    // space, we only include the player count if there are already players
+    // connected to the server.
+    if (querydata->num_players > 0)
+    {
+        M_snprintf(description, sizeof(description), "(%d/%d) ",
+                   querydata->num_players, querydata->max_players);
+    }
+    else
+    {
+        M_StringCopy(description, "", sizeof(description));
+    }
+
+    M_StringConcat(description, querydata->description, sizeof(description));
+
     TXT_AddWidgets(results_table,
                    TXT_NewLabel(ping_time_str),
                    TXT_NewButton2(NET_AddrToString(addr),
@@ -992,7 +1005,7 @@
                                TXT_UNCAST_ARG(user_data))
 {
     NET_StartMasterQuery();
-    ServerQueryWindow("Find internet server");
+    ServerQueryWindow("Find Internet server");
 }
 
 static void FindLANServer(TXT_UNCAST_ARG(widget),