Ticket #58: ioq3-syncrho_server_browser_backwards_compatible.patch

File ioq3-syncrho_server_browser_backwards_compatible.patch, 3.3 KB (added by ilag, 10 years ago)

Patched described in ticket description.

  • code/client/cl_main.c

    diff --git a/code/client/cl_main.c b/code/client/cl_main.c
    index 62f8ec9..31bbb8b 100644
    a b void CL_Init( void ) { 
    37283728        Cmd_AddCommand ("reconnect", CL_Reconnect_f);
    37293729        Cmd_AddCommand ("localservers", CL_LocalServers_f);
    37303730        Cmd_AddCommand ("globalservers", CL_GlobalServers_f);
     3731        Cmd_AddCommand ("globalserversallmaster", CL_GlobalServersAllMaster_f);
    37313732        Cmd_AddCommand ("rcon", CL_Rcon_f);
    37323733        Cmd_SetCommandCompletionFunc( "rcon", CL_CompleteRcon );
    37333734        Cmd_AddCommand ("ping", CL_Ping_f );
    void CL_Shutdown(char *finalmsg, qboolean disconnect, qboolean quit) 
    37983799        Cmd_RemoveCommand ("reconnect");
    37993800        Cmd_RemoveCommand ("localservers");
    38003801        Cmd_RemoveCommand ("globalservers");
     3802        Cmd_RemoveCommand ("globalserversallmaster");
    38013803        Cmd_RemoveCommand ("rcon");
    38023804        Cmd_RemoveCommand ("ping");
    38033805        Cmd_RemoveCommand ("serverstatus");
    void CL_GlobalServers_f( void ) { 
    43204322#endif
    43214323}
    43224324
     4325/*
     4326==================
     4327CL_GlobalServersAllMaster_f
     4328Joe Kari: attempt to have a command that get a list form *ALL* master server available.
     4329==================
     4330*/
     4331void CL_GlobalServersAllMaster_f( void ) {
     4332        netadr_t        to;
     4333        int                     count, i, masterNum;
     4334        char            command[1024], *masteraddress;
     4335       
     4336        if ((count = Cmd_Argc()) < 2 )
     4337        {
     4338                Com_Printf("usage: globalserversallmaster <protocol> [keywords]\n");
     4339                return;
     4340        }
     4341       
     4342        for ( masterNum = 0 ; masterNum < MAX_MASTER_SERVERS ; masterNum ++ )
     4343        {
     4344                sprintf(command, "sv_master%d", masterNum + 1);
     4345                masteraddress = Cvar_VariableString(command);
     4346
     4347                if(!*masteraddress)
     4348                        continue;
     4349
     4350                // reset the list, waiting for response
     4351                // -1 is used to distinguish a "no response"
     4352
     4353                i = NET_StringToAdr(masteraddress, &to, NA_UNSPEC);
     4354
     4355                if(!i)
     4356                        continue;
     4357                else if(i == 2) 
     4358                        to.port = BigShort(PORT_MASTER);
     4359
     4360                Com_Printf("Requesting servers from master %s...\n", masteraddress);
     4361
     4362                cls.numglobalservers = -1;
     4363                cls.pingUpdateSource = AS_GLOBAL;
     4364
     4365                // Use the extended query for IPv6 masters
     4366                if (to.type == NA_IP6 || to.type == NA_MULTICAST6)
     4367                {
     4368                        int v4enabled = Cvar_VariableIntegerValue("net_enabled") & NET_ENABLEV4;
     4369                       
     4370                        if(v4enabled)
     4371                        {
     4372                                Com_sprintf(command, sizeof(command), "getserversExt %s %s ipv6",
     4373                                        com_gamename->string, Cmd_Argv(1));
     4374                        }
     4375                        else
     4376                        {
     4377                                Com_sprintf(command, sizeof(command), "getserversExt %s %s",
     4378                                        com_gamename->string, Cmd_Argv(1));
     4379                        }
     4380
     4381                        // TODO: test if we only have an IPv6 connection. If it's the case,
     4382                        //       request IPv6 servers only by appending " ipv6" to the command
     4383                }
     4384                else
     4385                        Com_sprintf(command, sizeof(command), "getservers %s", Cmd_Argv(1));
     4386
     4387                for (i=2; i < count; i++)
     4388                {
     4389                        Q_strcat(command, sizeof(command), " ");
     4390                        Q_strcat(command, sizeof(command), Cmd_Argv(i));
     4391                }
     4392
     4393                NET_OutOfBandPrint( NS_SERVER, to, "%s", command );
     4394        }
     4395}
     4396
    43234397
    43244398/*
    43254399==================
  • code/client/client.h

    diff --git a/code/client/client.h b/code/client/client.h
    index 70fd03f..7ce634d 100644
    a b void CL_ParseServerMessage( msg_t *msg ); 
    543543void    CL_ServerInfoPacket( netadr_t from, msg_t *msg );
    544544void    CL_LocalServers_f( void );
    545545void    CL_GlobalServers_f( void );
     546void    CL_GlobalServersAllMaster_f( void );
    546547void    CL_FavoriteServers_f( void );
    547548void    CL_Ping_f( void );
    548549qboolean CL_UpdateVisiblePings_f( int source );