Browse Source

engine: client: switch to protocol info key in detecting old engine servers

pull/2/head
Alibek Omarov 3 years ago
parent
commit
37cf4da136
  1. 10
      engine/client/cl_main.c
  2. 2
      engine/client/client.h

10
engine/client/cl_main.c

@ -1563,7 +1563,6 @@ void CL_LocalServers_f( void )
Con_Printf( "Scanning for servers on the local network area...\n" ); Con_Printf( "Scanning for servers on the local network area...\n" );
NET_Config( true ); // allow remote NET_Config( true ); // allow remote
cls.legacyservercount = 0;
// send a broadcast packet // send a broadcast packet
adr.type = NA_BROADCAST; adr.type = NA_BROADCAST;
@ -1591,7 +1590,6 @@ void CL_InternetServers_f( void )
Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining ); Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining );
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining ); // let master know about client version Info_SetValueForKey( info, "clver", XASH_VERSION, remaining ); // let master know about client version
// Info_SetValueForKey( info, "nat", cl_nat->string, remaining ); // Info_SetValueForKey( info, "nat", cl_nat->string, remaining );
cls.legacyservercount = 0;
cls.internetservers_wait = NET_SendToMasters( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strlen( info ), fullquery ); cls.internetservers_wait = NET_SendToMasters( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strlen( info ), fullquery );
cls.internetservers_pending = true; cls.internetservers_pending = true;
@ -1722,8 +1720,6 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
{ {
Netchan_OutOfBandPrint( NS_CLIENT, from, "info %i", PROTOCOL_LEGACY_VERSION ); Netchan_OutOfBandPrint( NS_CLIENT, from, "info %i", PROTOCOL_LEGACY_VERSION );
Con_Printf( "^1Server^7: %s, Info: %s\n", NET_AdrToString( from ), infostring ); Con_Printf( "^1Server^7: %s, Info: %s\n", NET_AdrToString( from ), infostring );
if( cls.legacyservercount < MAX_LEGACY_SERVERS )
cls.legacyservers[cls.legacyservercount++] = from;
return; return;
} }
@ -1733,14 +1729,10 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
return; // unsupported proto return; // unsupported proto
} }
for( i = 0; i < cls.legacyservercount; i++ ) if( !COM_CheckString( Info_ValueForKey( infostring, "p" )))
{
if( NET_CompareAdr( cls.legacyservers[i], from ) )
{ {
Info_SetValueForKey( infostring, "legacy", "1", sizeof( infostring ) ); Info_SetValueForKey( infostring, "legacy", "1", sizeof( infostring ) );
Con_Print("Legacy: "); Con_Print("Legacy: ");
break;
}
} }
// more info about servers // more info about servers

2
engine/client/client.h

@ -625,8 +625,6 @@ typedef struct
// legacy mode support // legacy mode support
qboolean legacymode; // one-way 48 protocol compatibility qboolean legacymode; // one-way 48 protocol compatibility
netadr_t legacyserver; netadr_t legacyserver;
netadr_t legacyservers[MAX_LEGACY_SERVERS];
int legacyservercount;
int extensions; int extensions;
netadr_t serveradr; netadr_t serveradr;

Loading…
Cancel
Save