forked from nillerusr/source-engine
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gc_convar.cpp
68 lines (58 loc) · 1.68 KB
/
gc_convar.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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;
}