Files
funnygame/tier1/commandline.cpp
2025-07-13 15:47:42 +03:00

63 lines
1.0 KiB
C++

#include "tier1/commandline.h"
#include "tier1/utlvector.h"
CUtlVector<char*> cl_params;
void ICommandLine::CreateCommandLine( int argc, char **argv )
{
cl_params.AppendTail(argv,argc);
}
bool ICommandLine::CheckParam( const char *psz )
{
for (auto szParam: cl_params) {
if (!V_strcmp(szParam, psz))
{
return true;
}
}
return false;
}
char *ICommandLine::ParamValue( const char *psz, const char *szDefaultValue )
{
int i = 0;
for (auto szParam: cl_params) {
i++;
if (i>=cl_params.GetSize())
break;
if (!V_strcmp(szParam, psz))
return cl_params[i];
}
return (char*)szDefaultValue;
}
void ICommandLine::AddParam( char *psz )
{
}
void ICommandLine::RemoveParam( char *psz )
{
}
int ICommandLine::ParamCount()
{
return cl_params.GetSize();
}
int ICommandLine::FindParam( const char *psz )
{
int i = 0;
for (auto szParam: cl_params) {
if (!V_strcmp(szParam, psz))
return i;
i++;
}
return 0;
}
const char *ICommandLine::GetParam(int nIndex)
{
return cl_params[nIndex];
}
static ICommandLine g_CommandLine;