Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "stdafx.h"
  8. #include "gcsdk/gclogger.h"
  9. #include "memdbgon.h" // needs to be the last include in the file
  10. using namespace GCSDK;
  11. const char *GCConVar::GetName( void ) const
  12. {
  13. if ( m_strGCName.Length() == 0 )
  14. {
  15. m_pchBaseName = ConVar::GetName();
  16. if( GCSDK::GGCBase() )
  17. {
  18. m_strGCName.Format( "%s_%u", m_pchBaseName, GCSDK::GGCBase()->GetAppID() );
  19. }
  20. else
  21. {
  22. m_strGCName.Format( "%s_gc", m_pchBaseName );
  23. }
  24. }
  25. return m_strGCName.String();
  26. }
  27. const char *GCConCommand::GetName( void ) const
  28. {
  29. if ( m_strGCName.Length() == 0 )
  30. {
  31. m_pchBaseName = ConCommand::GetName();
  32. if( GCSDK::GGCBase() )
  33. {
  34. m_strGCName.Format( "%s_%u", m_pchBaseName, GCSDK::GGCBase()->GetAppID() );
  35. }
  36. else
  37. {
  38. m_strGCName.Format( "%s_gc", m_pchBaseName );
  39. }
  40. }
  41. return m_strGCName.String();
  42. }
  43. //-----------------------------------------------------------------------------
  44. // Purpose: Checks a command to see if it got enough arguments
  45. // Input : nArgs - The minimum required args on the command
  46. // args - The arguments passed to the command
  47. // command - The command being executed
  48. //-----------------------------------------------------------------------------
  49. bool BCheckArgs( int nArgs, const CCommand &args, const ConCommandBase &command )
  50. {
  51. if ( args.ArgC() <= nArgs )
  52. {
  53. EG_ERROR( SPEW_CONSOLE, "Incorrect number of arguments. %d arguments required, %d were given.\n", nArgs, args.ArgC() - 1 );
  54. EG_ERROR( SPEW_CONSOLE, "\t%s\n", command.GetHelpText() );
  55. return false;
  56. }
  57. return true;
  58. }