1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00

csgo: Update ICvar interface (#61)

* csgo: Update ICvar interface

GetCommandLineValue was replaced by HasCommandLineValue.
Update RegisterConCommand param name.

* Restore ICvar::GetCommandLineValue

* Make ICvar::GetCommandLineValue non-static
This commit is contained in:
Maxim Telezhenko 2019-10-10 02:05:47 +03:00 committed by Nicholas Hastings
parent 2f58b9d492
commit 802ae03f3f

View File

@ -62,13 +62,14 @@ public:
virtual CVarDLLIdentifier_t AllocateDLLIdentifier() = 0;
// Register, unregister commands
virtual void RegisterConCommand( ConCommandBase *pCommandBase, bool unknown=true ) = 0;
virtual void RegisterConCommand( ConCommandBase *pCommandBase, bool cmdline=true ) = 0;
virtual void UnregisterConCommand( ConCommandBase *pCommandBase ) = 0;
virtual void UnregisterConCommands( CVarDLLIdentifier_t id ) = 0;
// If there is a +<varname> <value> on the command line, this returns the value.
// Otherwise, it returns NULL.
virtual const char* GetCommandLineValue( const char *pVariableName ) = 0;
inline const char* GetCommandLineValue( const char *pVariableName );
virtual bool HasCommandLineValue( const char *pVariableName ) = 0;
// Try to find the cvar pointer by name
virtual ConCommandBase *FindCommandBase( const char *name ) = 0;
@ -197,6 +198,19 @@ inline ConCommandBase * ICvar::Iterator::Get( void )
return m_pIter->Get();
}
inline const char *ICvar::GetCommandLineValue( const char *pVariableName )
{
if (pVariableName[0] == '\0')
return NULL;
size_t len = strlen(pVariableName);
char *search = new char[len + 2];
search[0] = '+';
memcpy(&search[1], pVariableName, len + 1);
const char *value = CommandLine()->ParmValue(search);
delete[] search;
return value;
}
//-----------------------------------------------------------------------------
// These global names are defined by tier1.h, duplicated here so you