Added support for "custom" conditionals in KeyValues

This commit is contained in:
Blixibon 2022-10-16 15:16:53 -05:00
parent ccdc1719ae
commit 852d63ba6f

View File

@ -2082,6 +2082,28 @@ bool EvaluateConditional( const char *str )
if ( Q_stristr( str, "$POSIX" ) ) if ( Q_stristr( str, "$POSIX" ) )
return IsPosix() ^ bNot; return IsPosix() ^ bNot;
#ifdef MAPBASE
// Custom conditional
switch( str[bNot ? 1 : 0] )
{
case '%':
{
// Look for a cvar
ConVarRef cvar( str + (bNot ? 2 : 1), true );
if (cvar.IsValid())
{
return cvar.GetBool() ^ bNot;
}
} break;
case '-':
{
// Look for a command line param
return (CommandLine()->CheckParm( bNot ? str+1 : str ) != 0) ^ bNot;
} break;
}
#endif
return false; return false;
} }