From 37cf4da13642394c50ae138d8caa69742760fec0 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 8 Mar 2022 05:03:45 +0300 Subject: [PATCH] engine: client: switch to protocol info key in detecting old engine servers --- engine/client/cl_main.c | 14 +++----------- engine/client/client.h | 2 -- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index a0b79b95..688c7fc0 100644 --- a/engine/client/cl_main.c +++ b/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" ); NET_Config( true ); // allow remote - cls.legacyservercount = 0; // send a broadcast packet adr.type = NA_BROADCAST; @@ -1591,7 +1590,6 @@ void CL_InternetServers_f( void ) Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining ); Info_SetValueForKey( info, "clver", XASH_VERSION, remaining ); // let master know about client version // 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_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 ); Con_Printf( "^1Server^7: %s, Info: %s\n", NET_AdrToString( from ), infostring ); - if( cls.legacyservercount < MAX_LEGACY_SERVERS ) - cls.legacyservers[cls.legacyservercount++] = from; return; } @@ -1733,14 +1729,10 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg ) 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 ) ); - Con_Print("Legacy: "); - break; - } + Info_SetValueForKey( infostring, "legacy", "1", sizeof( infostring ) ); + Con_Print("Legacy: "); } // more info about servers diff --git a/engine/client/client.h b/engine/client/client.h index 0a15384a..03f75131 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -625,8 +625,6 @@ typedef struct // legacy mode support qboolean legacymode; // one-way 48 protocol compatibility netadr_t legacyserver; - netadr_t legacyservers[MAX_LEGACY_SERVERS]; - int legacyservercount; int extensions; netadr_t serveradr;