This is an automated email from the git hooks/post-receive script. smcv pushed a commit to tag 1.51b in repository iortcw.
commit a8e41b471f65c0e930a1fabbdbd6be426140d78b Author: MAN-AT-ARMS <m4n4t4...@gmail.com> Date: Fri Jul 21 07:45:15 2017 -0400 All: Make 'globalservers 0' fetch all masters --- MP/code/client/cl_main.c | 36 +++++++++++++++++++++++++++++++----- MP/code/ui/ui_main.c | 38 ++++++++++++++++++++------------------ SP/code/client/cl_main.c | 36 +++++++++++++++++++++++++++++++----- SP/code/ui/ui_main.c | 38 +++++++++++++++++++++----------------- 4 files changed, 103 insertions(+), 45 deletions(-) diff --git a/MP/code/client/cl_main.c b/MP/code/client/cl_main.c index 605c81d..ea3f6b6 100644 --- a/MP/code/client/cl_main.c +++ b/MP/code/client/cl_main.c @@ -2647,7 +2647,7 @@ void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extend byte* buffptr; byte* buffend; - Com_Printf( "CL_ServersResponsePacket\n" ); + Com_Printf( "CL_ServersResponsePacket from %s\n", NET_AdrToStringwPort( *from ) ); if ( cls.numglobalservers == -1 ) { // state to detect lack of servers or lack of response @@ -4767,6 +4767,9 @@ void CL_LocalServers_f( void ) { /* ================== CL_GlobalServers_f + +ioquake3 2008; added support for requesting five separate master servers using 0-4. +ioquake3 2017; made master 0 fetch all master servers and 1-5 request a single master server. ================== */ void CL_GlobalServers_f( void ) { @@ -4774,13 +4777,36 @@ void CL_GlobalServers_f( void ) { int count, i, masterNum; char command[1024], *masteraddress; - if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS - 1) + if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS) { - Com_Printf("usage: globalservers <master# 0-%d> <protocol> [keywords]\n", MAX_MASTER_SERVERS - 1); + Com_Printf("usage: globalservers <master# 0-%d> <protocol> [keywords]\n", MAX_MASTER_SERVERS); + return; + } + + // request from all master servers + if ( masterNum == 0 ) { + int numAddress = 0; + + for ( i = 1; i <= MAX_MASTER_SERVERS; i++ ) { + sprintf(command, "sv_master%d", i); + masteraddress = Cvar_VariableString(command); + + if(!*masteraddress) + continue; + + numAddress++; + + Com_sprintf(command, sizeof(command), "globalservers %d %s %s\n", i, Cmd_Argv(2), Cmd_ArgsFrom(3)); + Cbuf_AddText(command); + } + + if ( !numAddress ) { + Com_Printf( "CL_GlobalServers_f: Error: No master server addresses.\n"); + } return; } - sprintf(command, "sv_master%d", masterNum + 1); + sprintf(command, "sv_master%d", masterNum); masteraddress = Cvar_VariableString(command); if(!*masteraddress) @@ -4802,7 +4828,7 @@ void CL_GlobalServers_f( void ) { else if(i == 2) to.port = BigShort(PORT_MASTER); - Com_Printf("Requesting servers from master %s...\n", masteraddress); + Com_Printf("Requesting servers from %s (%s)...\n", masteraddress, NET_AdrToStringwPort(to)); cls.numglobalservers = -1; cls.pingUpdateSource = AS_GLOBAL; diff --git a/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c index c4dff6f..6d30ac7 100644 --- a/MP/code/ui/ui_main.c +++ b/MP/code/ui/ui_main.c @@ -71,21 +71,23 @@ static const char *skillLevels[] = { static const int numSkillLevels = ARRAY_LEN( skillLevels ); -#define UIAS_LOCAL 0 -#define UIAS_GLOBAL1 1 -#define UIAS_GLOBAL2 2 -#define UIAS_GLOBAL3 3 -#define UIAS_GLOBAL4 4 -#define UIAS_GLOBAL5 5 -#define UIAS_FAVORITES 6 +#define UIAS_LOCAL 0 +#define UIAS_GLOBAL0 1 +#define UIAS_GLOBAL1 2 +#define UIAS_GLOBAL2 3 +#define UIAS_GLOBAL3 4 +#define UIAS_GLOBAL4 5 +#define UIAS_GLOBAL5 6 +#define UIAS_FAVORITES 7 static const char *netSources[] = { "Local", - "Internet1", - "Internet2", - "Internet3", - "Internet4", - "Internet5", + "Internet", + "Master1", + "Master2", + "Master3", + "Master4", + "Master5", "Favorites" }; static const int numNetSources = ARRAY_LEN( netSources ); @@ -1466,6 +1468,7 @@ int UI_SourceForLAN(void) { default: case UIAS_LOCAL: return AS_LOCAL; + case UIAS_GLOBAL0: case UIAS_GLOBAL1: case UIAS_GLOBAL2: case UIAS_GLOBAL3: @@ -3170,7 +3173,7 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) { while(ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5) { - Com_sprintf(cvarname, sizeof(cvarname), "sv_master%d", ui_netSource.integer); + Com_sprintf(cvarname, sizeof(cvarname), "sv_master%d", ui_netSource.integer - UIAS_GLOBAL0); trap_Cvar_VariableStringBuffer(cvarname, masterstr, sizeof(masterstr)); if(*masterstr) break; @@ -7934,7 +7937,7 @@ static void UI_StartServerRefresh( qboolean full, qboolean force ) { // This function is called with force=qfalse when server browser menu opens or net source changes. // Automatically update local and favorite servers. // Only auto update master server list if there is no server info cache. - if ( !force && ( ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5 ) ) { + if ( !force && ( ui_netSource.integer >= UIAS_GLOBAL0 && ui_netSource.integer <= UIAS_GLOBAL5 ) ) { if ( trap_LAN_GetServerCount( UI_SourceForLAN() ) > 0 ) { return; // have cached list } @@ -7967,14 +7970,13 @@ static void UI_StartServerRefresh( qboolean full, qboolean force ) { } uiInfo.serverStatus.refreshtime = uiInfo.uiDC.realTime + 5000; - - if( ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5 ) { + if( ui_netSource.integer >= UIAS_GLOBAL0 && ui_netSource.integer <= UIAS_GLOBAL5 ) { ptr = UI_Cvar_VariableString( "debug_protocol" ); if ( strlen( ptr ) ) { - trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %s full empty\n", ui_netSource.integer - UIAS_GLOBAL1, ptr ) ); + trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %s full empty\n", ui_netSource.integer - UIAS_GLOBAL0, ptr ) ); } else { - trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %d full empty\n", ui_netSource.integer - UIAS_GLOBAL1, (int)trap_Cvar_VariableValue( "protocol" ) ) ); + trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %d full empty\n", ui_netSource.integer - UIAS_GLOBAL0, (int)trap_Cvar_VariableValue( "protocol" ) ) ); } } } diff --git a/SP/code/client/cl_main.c b/SP/code/client/cl_main.c index 2f18fd2..e8684e0 100644 --- a/SP/code/client/cl_main.c +++ b/SP/code/client/cl_main.c @@ -2460,7 +2460,7 @@ void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extend byte* buffptr; byte* buffend; - Com_Printf( "CL_ServersResponsePacket\n" ); + Com_Printf( "CL_ServersResponsePacket from %s\n", NET_AdrToStringwPort( *from ) ); if ( cls.numglobalservers == -1 ) { // state to detect lack of servers or lack of response @@ -4338,6 +4338,9 @@ void CL_LocalServers_f( void ) { /* ================== CL_GlobalServers_f + +ioquake3 2008; added support for requesting five separate master servers using 0-4. +ioquake3 2017; made master 0 fetch all master servers and 1-5 request a single master server. ================== */ void CL_GlobalServers_f( void ) { @@ -4345,13 +4348,36 @@ void CL_GlobalServers_f( void ) { int count, i, masterNum; char command[1024], *masteraddress; - if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS - 1) + if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS) { - Com_Printf("usage: globalservers <master# 0-%d> <protocol> [keywords]\n", MAX_MASTER_SERVERS - 1); + Com_Printf("usage: globalservers <master# 0-%d> <protocol> [keywords]\n", MAX_MASTER_SERVERS); + return; + } + + // request from all master servers + if ( masterNum == 0 ) { + int numAddress = 0; + + for ( i = 1; i <= MAX_MASTER_SERVERS; i++ ) { + sprintf(command, "sv_master%d", i); + masteraddress = Cvar_VariableString(command); + + if(!*masteraddress) + continue; + + numAddress++; + + Com_sprintf(command, sizeof(command), "globalservers %d %s %s\n", i, Cmd_Argv(2), Cmd_ArgsFrom(3)); + Cbuf_AddText(command); + } + + if ( !numAddress ) { + Com_Printf( "CL_GlobalServers_f: Error: No master server addresses.\n"); + } return; } - sprintf(command, "sv_master%d", masterNum + 1); + sprintf(command, "sv_master%d", masterNum); masteraddress = Cvar_VariableString(command); if(!*masteraddress) @@ -4373,7 +4399,7 @@ void CL_GlobalServers_f( void ) { else if(i == 2) to.port = BigShort(PORT_MASTER); - Com_Printf("Requesting servers from master %s...\n", masteraddress); + Com_Printf("Requesting servers from %s (%s)...\n", masteraddress, NET_AdrToStringwPort(to)); cls.numglobalservers = -1; cls.pingUpdateSource = AS_GLOBAL; diff --git a/SP/code/ui/ui_main.c b/SP/code/ui/ui_main.c index aaa4805..07f0f0b 100644 --- a/SP/code/ui/ui_main.c +++ b/SP/code/ui/ui_main.c @@ -61,21 +61,23 @@ static const char *skillLevels[] = { static const int numSkillLevels = ARRAY_LEN( skillLevels ); -#define UIAS_LOCAL 0 -#define UIAS_GLOBAL1 1 -#define UIAS_GLOBAL2 2 -#define UIAS_GLOBAL3 3 -#define UIAS_GLOBAL4 4 -#define UIAS_GLOBAL5 5 -#define UIAS_FAVORITES 6 +#define UIAS_LOCAL 0 +#define UIAS_GLOBAL0 1 +#define UIAS_GLOBAL1 2 +#define UIAS_GLOBAL2 3 +#define UIAS_GLOBAL3 4 +#define UIAS_GLOBAL4 5 +#define UIAS_GLOBAL5 6 +#define UIAS_FAVORITES 7 static const char *netSources[] = { "Local", - "Internet1", - "Internet2", - "Internet3", - "Internet4", - "Internet5", + "Internet", + "Master1", + "Master2", + "Master3", + "Master4", + "Master5", "Favorites" }; static const int numNetSources = ARRAY_LEN( netSources ); @@ -1155,6 +1157,7 @@ int UI_SourceForLAN(void) { default: case UIAS_LOCAL: return AS_LOCAL; + case UIAS_GLOBAL0: case UIAS_GLOBAL1: case UIAS_GLOBAL2: case UIAS_GLOBAL3: @@ -3209,7 +3212,7 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) { while(ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5) { - Com_sprintf(cvarname, sizeof(cvarname), "sv_master%d", ui_netSource.integer); + Com_sprintf(cvarname, sizeof(cvarname), "sv_master%d", ui_netSource.integer - UIAS_GLOBAL0); trap_Cvar_VariableStringBuffer(cvarname, masterstr, sizeof(masterstr)); if(*masterstr) break; @@ -7720,7 +7723,7 @@ static void UI_StartServerRefresh( qboolean full, qboolean force ) { // This function is called with force=qfalse when server browser menu opens or net source changes. // Automatically update local and favorite servers. // Only auto update master server list if there is no server info cache. - if ( !force && ( ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5 ) ) { + if ( !force && ( ui_netSource.integer >= UIAS_GLOBAL0 && ui_netSource.integer <= UIAS_GLOBAL5 ) ) { if ( trap_LAN_GetServerCount( UI_SourceForLAN() ) > 0 ) { return; // have cached list } @@ -7753,12 +7756,13 @@ static void UI_StartServerRefresh( qboolean full, qboolean force ) { } uiInfo.serverStatus.refreshtime = uiInfo.uiDC.realTime + 5000; - if( ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5 ) { + if( ui_netSource.integer >= UIAS_GLOBAL0 && ui_netSource.integer <= UIAS_GLOBAL5 ) { + ptr = UI_Cvar_VariableString( "debug_protocol" ); if ( strlen( ptr ) ) { - trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %s full empty\n", ui_netSource.integer - UIAS_GLOBAL1, ptr ) ); + trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %s full empty\n", ui_netSource.integer - UIAS_GLOBAL0, ptr ) ); } else { - trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %d full empty\n", ui_netSource.integer - UIAS_GLOBAL1, (int)trap_Cvar_VariableValue( "protocol" ) ) ); + trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %d full empty\n", ui_netSource.integer - UIAS_GLOBAL0, (int)trap_Cvar_VariableValue( "protocol" ) ) ); } } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits