mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 06:45:31 +03:00
Added support for "custom" conditionals in KeyValues
This commit is contained in:
parent
ccdc1719ae
commit
852d63ba6f
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user