mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-12-22 17:01:14 +01:00
engine: move client adding functions to their appropriate subsystems and make them static. Make in-engine functions inlined.
This commit is contained in:
parent
fdcf267fe3
commit
a834f4996f
@ -1765,6 +1765,17 @@ static cvar_t *GAME_EXPORT pfnCvar_RegisterClientVariable( const char *szName, c
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_CLIENTDLL ));
|
||||
}
|
||||
|
||||
static int GAME_EXPORT Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
int flags = CMD_CLIENTDLL;
|
||||
|
||||
// a1ba: try to mitigate outdated client.dll vulnerabilities
|
||||
if( !Q_stricmp( cmd_name, "motd_write" ))
|
||||
flags |= CMD_PRIVILEGED;
|
||||
|
||||
return Cmd_AddCommandEx( cmd_name, function, "client command", flags, __func__ );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnHookUserMsg
|
||||
|
@ -694,6 +694,11 @@ static cvar_t *GAME_EXPORT pfnCvar_RegisterGameUIVariable( const char *szName, c
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_GAMEUIDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_GAMEUIDLL ));
|
||||
}
|
||||
|
||||
static int GAME_EXPORT Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
return Cmd_AddCommandEx( cmd_name, function, "gameui command", CMD_GAMEUIDLL, __func__ );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnClientCmd
|
||||
|
@ -181,6 +181,11 @@ static void pfnCvar_FullSet( const char *var_name, const char *value, int flags
|
||||
Cvar_FullSet( var_name, value, flags | FCVAR_REFDLL );
|
||||
}
|
||||
|
||||
static int Cmd_AddRefCommand( const char *cmd_name, xcommand_t function, const char *description )
|
||||
{
|
||||
return Cmd_AddCommandEx( cmd_name, function, description, CMD_REFDLL, __func__ );
|
||||
}
|
||||
|
||||
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
||||
{
|
||||
clgame.dllFuncs.pfnStudioEvent( event, e );
|
||||
|
@ -670,8 +670,7 @@ void Cmd_TokenizeString( const char *text )
|
||||
Cmd_AddCommandEx
|
||||
============
|
||||
*/
|
||||
static int Cmd_AddCommandEx( const char *funcname, const char *cmd_name, xcommand_t function,
|
||||
const char *cmd_desc, int iFlags )
|
||||
int Cmd_AddCommandEx( const char *cmd_name, xcommand_t function, const char *cmd_desc, int iFlags, const char *funcname )
|
||||
{
|
||||
cmd_t *cmd, *cur, *prev;
|
||||
|
||||
@ -716,75 +715,6 @@ static int Cmd_AddCommandEx( const char *funcname, const char *cmd_name, xcomman
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddCommand
|
||||
============
|
||||
*/
|
||||
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc )
|
||||
{
|
||||
Cmd_AddCommandEx( __func__, cmd_name, function, cmd_desc, 0 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddRestrictedCommand
|
||||
============
|
||||
*/
|
||||
void Cmd_AddRestrictedCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc )
|
||||
{
|
||||
Cmd_AddCommandEx( __func__, cmd_name, function, cmd_desc, CMD_PRIVILEGED );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddServerCommand
|
||||
============
|
||||
*/
|
||||
void GAME_EXPORT Cmd_AddServerCommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
Cmd_AddCommandEx( __func__, cmd_name, function, "server command", CMD_SERVERDLL );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddClientCommand
|
||||
============
|
||||
*/
|
||||
int GAME_EXPORT Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
int flags = CMD_CLIENTDLL;
|
||||
|
||||
// a1ba: try to mitigate outdated client.dll vulnerabilities
|
||||
if( !Q_stricmp( cmd_name, "motd_write" ))
|
||||
{
|
||||
flags |= CMD_PRIVILEGED;
|
||||
}
|
||||
|
||||
return Cmd_AddCommandEx( __func__, cmd_name, function, "client command", flags );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddGameUICommand
|
||||
============
|
||||
*/
|
||||
int GAME_EXPORT Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
return Cmd_AddCommandEx( __func__, cmd_name, function, "gameui command", CMD_GAMEUIDLL );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddRefCommand
|
||||
============
|
||||
*/
|
||||
int Cmd_AddRefCommand( const char *cmd_name, xcommand_t function, const char *description )
|
||||
{
|
||||
return Cmd_AddCommandEx( __func__, cmd_name, function, description, CMD_REFDLL );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_RemoveCommand
|
||||
|
@ -431,12 +431,23 @@ const char *Cmd_Args( void ) RETURNS_NONNULL;
|
||||
const char *Cmd_Argv( int arg ) RETURNS_NONNULL;
|
||||
void Cmd_Init( void );
|
||||
void Cmd_Unlink( int group );
|
||||
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
|
||||
void Cmd_AddRestrictedCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
|
||||
void Cmd_AddServerCommand( const char *cmd_name, xcommand_t function );
|
||||
int Cmd_AddClientCommand( const char *cmd_name, xcommand_t function );
|
||||
int Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function );
|
||||
int Cmd_AddRefCommand( const char *cmd_name, xcommand_t function, const char *description );
|
||||
int Cmd_AddCommandEx( const char *cmd_name, xcommand_t function, const char *cmd_desc, int iFlags, const char *funcname );
|
||||
|
||||
static inline void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc )
|
||||
{
|
||||
Cmd_AddCommandEx( cmd_name, function, cmd_desc, 0, __func__ );
|
||||
}
|
||||
|
||||
static inline void Cmd_AddRestrictedCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc )
|
||||
{
|
||||
Cmd_AddCommandEx( cmd_name, function, cmd_desc, CMD_PRIVILEGED, __func__ );
|
||||
}
|
||||
|
||||
static inline void Cmd_AddFilteredCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc )
|
||||
{
|
||||
Cmd_AddCommandEx( cmd_name, function, cmd_desc, CMD_PRIVILEGED, __func__ );
|
||||
}
|
||||
|
||||
void Cmd_RemoveCommand( const char *cmd_name );
|
||||
qboolean Cmd_Exists( const char *cmd_name );
|
||||
void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback );
|
||||
|
@ -4438,6 +4438,11 @@ static void GAME_EXPORT pfnGetPlayerStats( const edict_t *pClient, int *ping, in
|
||||
if( ping ) *ping = cl->latency * 1000;
|
||||
}
|
||||
|
||||
static void GAME_EXPORT Cmd_AddServerCommand( const char *cmd_name, xcommand_t function )
|
||||
{
|
||||
Cmd_AddCommandEx( cmd_name, function, "server command", CMD_SERVERDLL, __func__ );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnForceUnmodified
|
||||
|
Loading…
Reference in New Issue
Block a user