|
|
@ -35,26 +35,14 @@ SV_SourceQuery_Details |
|
|
|
void SV_SourceQuery_Details( netadr_t from ) |
|
|
|
void SV_SourceQuery_Details( netadr_t from ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
sizebuf_t buf; |
|
|
|
sizebuf_t buf; |
|
|
|
char answer[2048] = ""; |
|
|
|
char answer[2048]; |
|
|
|
char version[128] = ""; |
|
|
|
int i, bot_count, client_count; |
|
|
|
|
|
|
|
|
|
|
|
int i, bot_count = 0, client_count = 0; |
|
|
|
|
|
|
|
int is_private = 0; |
|
|
|
int is_private = 0; |
|
|
|
|
|
|
|
|
|
|
|
if ( svs.clients ) |
|
|
|
SV_GetPlayerCount( &client_count, &bot_count ); |
|
|
|
{ |
|
|
|
client_count += bot_count; // bots are counted as players in this reply
|
|
|
|
for ( i = 0; i < svs.maxclients; i++ ) |
|
|
|
if( COM_CheckStringEmpty( sv_password.string ) && Q_stricmp( sv_password.string, "none" )) |
|
|
|
{ |
|
|
|
is_private = 1; |
|
|
|
if ( svs.clients[i].state >= cs_connected ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( svs.clients[i].edict->v.flags & FL_FAKECLIENT ) |
|
|
|
|
|
|
|
bot_count++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
client_count++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
is_private = ( sv_password.string[0] && ( Q_stricmp( sv_password.string, "none" ) || !Q_strlen( sv_password.string ) ) ? 1 : 0 ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MSG_Init( &buf, "TSourceEngineQuery", answer, sizeof( answer )); |
|
|
|
MSG_Init( &buf, "TSourceEngineQuery", answer, sizeof( answer )); |
|
|
|
|
|
|
|
|
|
|
@ -73,9 +61,9 @@ void SV_SourceQuery_Details( netadr_t from ) |
|
|
|
MSG_WriteByte( &buf, bot_count ); |
|
|
|
MSG_WriteByte( &buf, bot_count ); |
|
|
|
|
|
|
|
|
|
|
|
MSG_WriteByte( &buf, Host_IsDedicated( ) ? 'd' : 'l' ); |
|
|
|
MSG_WriteByte( &buf, Host_IsDedicated( ) ? 'd' : 'l' ); |
|
|
|
#if defined( _WIN32 ) |
|
|
|
#if XASH_WIN32 |
|
|
|
MSG_WriteByte( &buf, 'w' ); |
|
|
|
MSG_WriteByte( &buf, 'w' ); |
|
|
|
#elif defined( __APPLE__ ) |
|
|
|
#elif XASH_APPLE |
|
|
|
MSG_WriteByte( &buf, 'm' ); |
|
|
|
MSG_WriteByte( &buf, 'm' ); |
|
|
|
#else |
|
|
|
#else |
|
|
|
MSG_WriteByte( &buf, 'l' ); |
|
|
|
MSG_WriteByte( &buf, 'l' ); |
|
|
@ -95,14 +83,13 @@ SV_SourceQuery_Rules |
|
|
|
void SV_SourceQuery_Rules( netadr_t from ) |
|
|
|
void SV_SourceQuery_Rules( netadr_t from ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
sizebuf_t buf; |
|
|
|
sizebuf_t buf; |
|
|
|
char answer[1024 * 8] = ""; |
|
|
|
char answer[1024 * 8]; |
|
|
|
|
|
|
|
|
|
|
|
cvar_t *cvar; |
|
|
|
cvar_t *cvar; |
|
|
|
int cvar_count = 0; |
|
|
|
int cvar_count = 0; |
|
|
|
|
|
|
|
|
|
|
|
for( cvar = Cvar_GetList( ); cvar; cvar = cvar->next ) |
|
|
|
for( cvar = Cvar_GetList( ); cvar; cvar = cvar->next ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( cvar->flags & FCVAR_SERVER ) |
|
|
|
if( FBitSet( cvar->flags, FCVAR_SERVER )) |
|
|
|
cvar_count++; |
|
|
|
cvar_count++; |
|
|
|
} |
|
|
|
} |
|
|
|
if( cvar_count <= 0 ) |
|
|
|
if( cvar_count <= 0 ) |
|
|
@ -116,13 +103,13 @@ void SV_SourceQuery_Rules( netadr_t from ) |
|
|
|
|
|
|
|
|
|
|
|
for( cvar = Cvar_GetList( ); cvar; cvar = cvar->next ) |
|
|
|
for( cvar = Cvar_GetList( ); cvar; cvar = cvar->next ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( !( cvar->flags & FCVAR_SERVER ) ) |
|
|
|
if( !FBitSet( cvar->flags, FCVAR_SERVER )) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
MSG_WriteString( &buf, cvar->name ); |
|
|
|
MSG_WriteString( &buf, cvar->name ); |
|
|
|
|
|
|
|
|
|
|
|
if ( cvar->flags & FCVAR_PROTECTED ) |
|
|
|
if( FBitSet( cvar->flags, FCVAR_PROTECTED )) |
|
|
|
MSG_WriteString( &buf, ( Q_strlen( cvar->string ) > 0 && Q_stricmp( cvar->string, "none" ) ) ? "1" : "0" ); |
|
|
|
MSG_WriteString( &buf, ( COM_CheckStringEmpty( cvar->string ) && Q_stricmp( cvar->string, "none" )) ? "1" : "0" ); |
|
|
|
else |
|
|
|
else |
|
|
|
MSG_WriteString( &buf, cvar->string ); |
|
|
|
MSG_WriteString( &buf, cvar->string ); |
|
|
|
} |
|
|
|
} |
|
|
@ -137,18 +124,11 @@ SV_SourceQuery_Players |
|
|
|
void SV_SourceQuery_Players( netadr_t from ) |
|
|
|
void SV_SourceQuery_Players( netadr_t from ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
sizebuf_t buf; |
|
|
|
sizebuf_t buf; |
|
|
|
char answer[1024 * 8] = ""; |
|
|
|
char answer[1024 * 8]; |
|
|
|
|
|
|
|
int i, client_count, bot_count_unused; |
|
|
|
|
|
|
|
|
|
|
|
int i, client_count = 0; |
|
|
|
SV_GetPlayerCount( &client_count, &bot_count_unused ); |
|
|
|
|
|
|
|
|
|
|
|
if ( svs.clients ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for ( i = 0; i < svs.maxclients; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( svs.clients[i].state >= cs_connected ) |
|
|
|
|
|
|
|
client_count++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if( client_count <= 0 ) |
|
|
|
if( client_count <= 0 ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
@ -168,7 +148,9 @@ void SV_SourceQuery_Players( netadr_t from ) |
|
|
|
MSG_WriteByte( &buf, i ); |
|
|
|
MSG_WriteByte( &buf, i ); |
|
|
|
MSG_WriteString( &buf, cl->name ); |
|
|
|
MSG_WriteString( &buf, cl->name ); |
|
|
|
MSG_WriteLong( &buf, cl->edict->v.frags ); |
|
|
|
MSG_WriteLong( &buf, cl->edict->v.frags ); |
|
|
|
MSG_WriteFloat( &buf, ( cl->edict->v.flags & FL_FAKECLIENT ) ? -1.0 : ( host.realtime - cl->connecttime ) ); |
|
|
|
if( FBitSet( cl->flags, FCL_FAKECLIENT )) |
|
|
|
|
|
|
|
MSG_WriteFloat( &buf, -1.0f ); |
|
|
|
|
|
|
|
else MSG_WriteFloat( &buf, host.realtime - cl->connecttime ); |
|
|
|
} |
|
|
|
} |
|
|
|
NET_SendPacket( NS_SERVER, MSG_GetNumBytesWritten( &buf ), MSG_GetData( &buf ), from ); |
|
|
|
NET_SendPacket( NS_SERVER, MSG_GetNumBytesWritten( &buf ), MSG_GetData( &buf ), from ); |
|
|
|
} |
|
|
|
} |
|
|
|