Browse Source

legacymode: add legacy infokey for legacy servers

pull/2/head
mittorn 6 years ago
parent
commit
c09190f66e
  1. 15
      engine/client/cl_main.c
  2. 2
      engine/client/client.h
  3. 2
      engine/common/protocol.h

15
engine/client/cl_main.c

@ -1491,6 +1491,7 @@ void CL_LocalServers_f( void ) @@ -1491,6 +1491,7 @@ 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;
@ -1518,6 +1519,7 @@ void CL_InternetServers_f( void ) @@ -1518,6 +1519,7 @@ 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;
@ -1640,6 +1642,7 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg ) @@ -1640,6 +1642,7 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
{
static char infostring[MAX_INFO_STRING+8];
char *s = MSG_ReadString( msg );
int i;
CL_FixupColorStringsForInfoString( s, infostring );
@ -1647,6 +1650,8 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg ) @@ -1647,6 +1650,8 @@ 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;
}
@ -1656,6 +1661,16 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg ) @@ -1656,6 +1661,16 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
return; // unsupported proto
}
for( i = 0; i < cls.legacyservercount; i++ )
{
if( NET_CompareAdr( cls.legacyservers[i], from ) )
{
Info_SetValueForKey( infostring, "legacy", "1", sizeof( infostring ) );
Con_Print("Legacy: ");
break;
}
}
// more info about servers
Con_Printf( "^2Server^7: %s, Game: %s\n", NET_AdrToString( from ), Info_ValueForKey( infostring, "gamedir" ));

2
engine/client/client.h

@ -663,6 +663,8 @@ typedef struct @@ -663,6 +663,8 @@ typedef struct
qboolean internetservers_pending; // internetservers is waiting for dns request
qboolean legacymode; // one-way 48 protocol compatibility
netadr_t legacyserver;
netadr_t legacyservers[MAX_LEGACY_SERVERS];
int legacyservercount;
} client_static_t;
#ifdef __cplusplus

2
engine/common/protocol.h

@ -259,4 +259,6 @@ extern const char *clc_strings[clc_lastmsg+1]; @@ -259,4 +259,6 @@ extern const char *clc_strings[clc_lastmsg+1];
#define MAX_LEGACY_ENTITY_BITS 12
#define MAX_LEGACY_WEAPON_BITS 5
#define MAX_LEGACY_MODEL_BITS 11
#define MAX_LEGACY_SERVERS 32
#endif//NET_PROTOCOL_H

Loading…
Cancel
Save