From f98136b12bc52a2d9115248df5409403d373d294 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 2 Dec 2007 16:49:17 +0000 Subject: [PATCH] removed all but ocrana qw master as the rest were not responding added 4 other qw masters from the quakeservers.net website added player count on server browser fixed bug in server browser that always showed number of players in red (because numhumans was not being set by qw server query code) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7748 d7cf8633-e32d-0410-b094-e92efae38249 --- menu.c | 5 +++-- netconn.c | 36 +++++++++++++++++++++++------------- netconn.h | 2 ++ 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/menu.c b/menu.c index 6a99d656..1ab12b6a 100644 --- a/menu.c +++ b/menu.c @@ -4332,7 +4332,7 @@ void M_Menu_ServerList_f (void) static void M_ServerList_Draw (void) { - int n, y, visible, start, end; + int n, y, visible, start, end, numplayers, maxplayers; cachepic_t *p; const char *s; @@ -4342,7 +4342,8 @@ static void M_ServerList_Draw (void) else M_Background(640, vid_conheight.integer); // scroll the list as the cursor moves - s = va("%i/%i masters %i/%i servers", masterreplycount, masterquerycount, serverreplycount, serverquerycount); + ServerList_GetPlayerStatistics(&numplayers, &maxplayers); + s = va("%i/%i masters %i/%i servers %i/%i players", masterreplycount, masterquerycount, serverreplycount, serverquerycount, numplayers, maxplayers); M_PrintRed((640 - strlen(s) * 8) / 2, 32, s); if (*m_return_reason) M_Print(16, menu_height - 8, m_return_reason); diff --git a/netconn.c b/netconn.c index 9ef54550..70866bfe 100755 --- a/netconn.c +++ b/netconn.c @@ -48,19 +48,11 @@ static cvar_t sv_qwmasters [] = {CVAR_SAVE, "sv_qwmaster2", "", "user-chosen qwmaster server 2"}, {CVAR_SAVE, "sv_qwmaster3", "", "user-chosen qwmaster server 3"}, {CVAR_SAVE, "sv_qwmaster4", "", "user-chosen qwmaster server 4"}, - {0, "sv_qwmasterextra1", "192.246.40.37:27000", "id Limbo (admin: id Software)"}, - {0, "sv_qwmasterextra2", "192.246.40.37:27002", "id CTF (admin: id Software)"}, - {0, "sv_qwmasterextra3", "192.246.40.37:27003", "id TeamFortress (admin: id Software)"}, - {0, "sv_qwmasterextra4", "192.246.40.37:27004", "id Miscilaneous (admin: id Software)"}, - {0, "sv_qwmasterextra5", "192.246.40.37:27006", "id Deathmatch Only (admin: id Software)"}, - {0, "sv_qwmasterextra6", "150.254.66.120:27000", "Poland's master server. (admin: unknown)"}, - {0, "sv_qwmasterextra7", "62.112.145.129:27000", "Ocrana master server. (admin: unknown)"}, - {0, "sv_qwmasterextra8", "master.edome.net", "edome master server. (admin: unknown)"}, - {0, "sv_qwmasterextra9", "qwmaster.barrysworld.com", "barrysworld master server. (admin: unknown)"}, - {0, "sv_qwmasterextra10", "qwmaster.ocrana.de:27000", "Ocrana2 master server. (admin: unknown)"}, - {0, "sv_qwmasterextra11", "213.221.174.165:27000", "unknown1 master server. (admin: unknown)"}, - {0, "sv_qwmasterextra12", "195.74.0.8", "unknown2 master server. (admin: unknown)"}, - {0, "sv_qwmasterextra13", "204.182.161.2", "unknown3 master server. (admin: unknown)"}, + {0, "sv_qwmasterextra1", "master.quakeservers.net:27000", "Global master server. (admin: unknown)"}, + {0, "sv_qwmasterextra2", "asgaard.morphos-team.net:27000", "Global master server. (admin: unknown)"}, + {0, "sv_qwmasterextra3", "qwmaster.ocrana.de:27000", "German master server. (admin: unknown)"}, + {0, "sv_qwmasterextra4", "masterserver.exhale.de:27000", "German master server. (admin: unknown)"}, + {0, "sv_qwmasterextra5", "kubus.rulez.pl:27000", "Poland master server. (admin: unknown)"}, {0, NULL, NULL, NULL} }; @@ -412,6 +404,22 @@ void ServerList_ResetMasks(void) serverlist_ormasks[i].info.numbots = -1; } +void ServerList_GetPlayerStatistics(int *numplayerspointer, int *maxplayerspointer) +{ + int i; + int numplayers = 0, maxplayers = 0; + for (i = 0;i < serverlist_cachecount;i++) + { + if (serverlist_cache[i].query == SQS_QUERIED) + { + numplayers += serverlist_cache[i].info.numhumans; + maxplayers += serverlist_cache[i].info.maxplayers; + } + } + *numplayerspointer = numplayers; + *maxplayerspointer = maxplayers; +} + #if 0 static void _ServerList_Test(void) { @@ -1535,6 +1543,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat if ((s = SearchInfostring(string, "hostname" )) != NULL) strlcpy(info->name, s, sizeof (info->name));else info->name[0] = 0; info->protocol = 0; info->numplayers = 0; // updated below + info->numhumans = 0; // updated below if ((s = SearchInfostring(string, "maxclients" )) != NULL) info->maxplayers = atoi(s);else info->maxplayers = 0; if ((s = SearchInfostring(string, "gameversion" )) != NULL) info->gameversion = atoi(s);else info->gameversion = 0; @@ -1551,6 +1560,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat if (s >= string + length) break; info->numplayers++; + info->numhumans++; s++; } } diff --git a/netconn.h b/netconn.h index f211b1e4..2ac31331 100755 --- a/netconn.h +++ b/netconn.h @@ -326,6 +326,8 @@ extern int serverlist_cachecount; extern qboolean serverlist_consoleoutput; +void ServerList_GetPlayerStatistics(int *numplayerspointer, int *maxplayerspointer); + //============================================================================ // // public network functions -- 2.39.2