mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-25 22:35:31 +03:00
Added support for "custom" conditionals in KeyValues
This commit is contained in:
parent
ccdc1719ae
commit
852d63ba6f
@ -2081,6 +2081,28 @@ bool EvaluateConditional( const char *str )
|
||||
|
||||
if ( Q_stristr( str, "$POSIX" ) )
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user