summaryrefslogtreecommitdiff
path: root/gcsdk/gc_convar.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /gcsdk/gc_convar.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'gcsdk/gc_convar.cpp')
-rw-r--r--gcsdk/gc_convar.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/gcsdk/gc_convar.cpp b/gcsdk/gc_convar.cpp
new file mode 100644
index 0000000..0376562
--- /dev/null
+++ b/gcsdk/gc_convar.cpp
@@ -0,0 +1,68 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#include "stdafx.h"
+#include "gcsdk/gclogger.h"
+
+#include "memdbgon.h" // needs to be the last include in the file
+
+using namespace GCSDK;
+
+const char *GCConVar::GetName( void ) const
+{
+ if ( m_strGCName.Length() == 0 )
+ {
+ m_pchBaseName = ConVar::GetName();
+ if( GCSDK::GGCBase() )
+ {
+ m_strGCName.Format( "%s_%u", m_pchBaseName, GCSDK::GGCBase()->GetAppID() );
+ }
+ else
+ {
+ m_strGCName.Format( "%s_gc", m_pchBaseName );
+ }
+ }
+
+ return m_strGCName.String();
+}
+
+
+const char *GCConCommand::GetName( void ) const
+{
+ if ( m_strGCName.Length() == 0 )
+ {
+ m_pchBaseName = ConCommand::GetName();
+ if( GCSDK::GGCBase() )
+ {
+ m_strGCName.Format( "%s_%u", m_pchBaseName, GCSDK::GGCBase()->GetAppID() );
+ }
+ else
+ {
+ m_strGCName.Format( "%s_gc", m_pchBaseName );
+ }
+ }
+
+ return m_strGCName.String();
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Checks a command to see if it got enough arguments
+// Input : nArgs - The minimum required args on the command
+// args - The arguments passed to the command
+// command - The command being executed
+//-----------------------------------------------------------------------------
+bool BCheckArgs( int nArgs, const CCommand &args, const ConCommandBase &command )
+{
+ if ( args.ArgC() <= nArgs )
+ {
+ EG_ERROR( SPEW_CONSOLE, "Incorrect number of arguments. %d arguments required, %d were given.\n", nArgs, args.ArgC() - 1 );
+ EG_ERROR( SPEW_CONSOLE, "\t%s\n", command.GetHelpText() );
+ return false;
+ }
+
+ return true;
+}