mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-22 01:47:45 +01:00
Use filtered command buffer when string came from network (#241)
* cdll_int: add undocumented FilteredClientCmd function to client interface * client: use filtered command buffer where we have to execute command from server * client: use normal pfnClientCmd in place of pfnFilteredClientCmd in case of engine doesn't supports it * client: don't read out of bounds if engine interface is old and don't have pfnFilteredClientCmd * client: fix incorrect cvar pointer comparison
This commit is contained in:
parent
e7ef84c83d
commit
808be9442f
@ -167,7 +167,17 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
|
|||||||
if( iVersion != CLDLL_INTERFACE_VERSION )
|
if( iVersion != CLDLL_INTERFACE_VERSION )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memcpy( &gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t) );
|
// for now filterstuffcmd is last in the engine interface
|
||||||
|
memcpy( &gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t) - sizeof( void * ) );
|
||||||
|
|
||||||
|
if( gEngfuncs.pfnGetCvarPointer( "cl_filterstuffcmd" ) == 0 )
|
||||||
|
{
|
||||||
|
gEngfuncs.pfnFilteredClientCmd = gEngfuncs.pfnClientCmd;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gEngfuncs.pfnFilteredClientCmd = pEnginefuncs->pfnFilteredClientCmd;
|
||||||
|
}
|
||||||
|
|
||||||
EV_HookEvents();
|
EV_HookEvents();
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
|
|||||||
case DRC_CMD_FADE:
|
case DRC_CMD_FADE:
|
||||||
break;
|
break;
|
||||||
case DRC_CMD_STUFFTEXT:
|
case DRC_CMD_STUFFTEXT:
|
||||||
ClientCmd( READ_STRING() );
|
gEngfuncs.pfnFilteredClientCmd( READ_STRING() );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gEngfuncs.Con_DPrintf( "CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
|
gEngfuncs.Con_DPrintf( "CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
|
||||||
|
@ -667,7 +667,7 @@ public:
|
|||||||
|
|
||||||
virtual void actionPerformed(Panel *panel)
|
virtual void actionPerformed(Panel *panel)
|
||||||
{
|
{
|
||||||
gEngfuncs.pfnClientCmd( m_pszCommand );
|
gEngfuncs.pfnFilteredClientCmd( m_pszCommand );
|
||||||
|
|
||||||
if( m_iCloseVGUIMenu )
|
if( m_iCloseVGUIMenu )
|
||||||
gViewPort->HideTopMenu();
|
gViewPort->HideTopMenu();
|
||||||
|
@ -303,6 +303,9 @@ typedef struct cl_enginefuncs_s
|
|||||||
int (*pfnGetAppID)( void );
|
int (*pfnGetAppID)( void );
|
||||||
cmdalias_t *(*pfnGetAliases)( void );
|
cmdalias_t *(*pfnGetAliases)( void );
|
||||||
void (*pfnVguiWrap2_GetMouseDelta)( int *x, int *y );
|
void (*pfnVguiWrap2_GetMouseDelta)( int *x, int *y );
|
||||||
|
|
||||||
|
// added in 2019 update, not documented yet
|
||||||
|
int (*pfnFilteredClientCmd)( const char *cmd );
|
||||||
} cl_enginefunc_t;
|
} cl_enginefunc_t;
|
||||||
|
|
||||||
#define CLDLL_INTERFACE_VERSION 7
|
#define CLDLL_INTERFACE_VERSION 7
|
||||||
|
Loading…
Reference in New Issue
Block a user