engine: server: avoid useless copying in SV_GetClientIDString for bots or local clients
This commit is contained in:
parent
b28c1186b2
commit
0a85734ae7
1 changed files with 11 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue