diff --git a/public/icvar.h b/public/icvar.h index ffb795bd..7a2c1204 100644 --- a/public/icvar.h +++ b/public/icvar.h @@ -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 + 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