mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-08 21:31:46 +08:00
engine: server: avoid useless copying in SV_GetClientIDString for bots or local clients
This commit is contained in:
@@ -770,27 +770,21 @@ Returns a pointer to a static char for most likely only printing.
|
||||
*/
|
||||
const char *SV_GetClientIDString( sv_client_t *cl )
|
||||
{
|
||||
static char result[MAX_QPATH];
|
||||
static char result[MAX_QPATH];
|
||||
|
||||
if( !cl ) return "";
|
||||
if( !cl )
|
||||
return "";
|
||||
|
||||
if( FBitSet( cl->flags, FCL_FAKECLIENT ))
|
||||
{
|
||||
Q_strncpy( result, "ID_BOT", sizeof( result ));
|
||||
}
|
||||
else if( NET_IsLocalAddress( cl->netchan.remote_address ))
|
||||
{
|
||||
Q_strncpy( result, "ID_LOOPBACK", sizeof( result ));
|
||||
}
|
||||
else if( sv_lan.value )
|
||||
{
|
||||
Q_strncpy( result, "ID_LAN", sizeof( result ));
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_snprintf( result, sizeof( result ), "ID_%s", MD5_Print( (byte *)cl->hashedcdkey ));
|
||||
}
|
||||
return "ID_BOT";
|
||||
|
||||
if( NET_IsLocalAddress( cl->netchan.remote_address ))
|
||||
return "ID_LOOPBACK";
|
||||
|
||||
if( sv_lan.value )
|
||||
return "ID_LAN";
|
||||
|
||||
Q_snprintf( result, sizeof( result ), "ID_%s", MD5_Print( (byte *)cl->hashedcdkey ));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user