KF2-StartWave/StartWave/Classes/OptionsParser.uc

87 lines
2.7 KiB
Ucode
Raw Normal View History

2023-05-20 18:10:14 +00:00
class OptionsParser extends Object;
const GameInfo = class'GameInfo';
/**
*** @brief Gets a int from the launch command if available.
***
*** @param Options - options passed in via the launch command
*** @param ParseString - the variable we are looking for
*** @param CurrentValue - the current value of the variable
*** @return int value of the option we are looking for
***/
2023-05-20 18:27:00 +00:00
static function int GetIntOption( String Options, String ParseString, int CurrentValue)
2023-05-20 18:10:14 +00:00
{
return GameInfo.static.GetIntOption(Options, ParseString, CurrentValue);
}
/**
*** @brief Gets a bool from the launch command if available.
***
*** @param Options - options passed in via the launch command
*** @param ParseString - the variable we are looking for
*** @param CurrentValue - the current value of the variable
*** @return bool value of the option we are looking for
***/
2023-05-20 18:27:00 +00:00
static public function bool GetBoolOption(String Options, String ParseString, bool CurrentValue)
2023-05-20 18:10:14 +00:00
{
2023-05-20 18:27:00 +00:00
local String InOpt;
2023-05-20 18:10:14 +00:00
//Find the value associated with this variable in the launch command.
InOpt = GameInfo.static.ParseOption(Options, ParseString);
2023-05-20 18:27:00 +00:00
if (InOpt != "")
2023-05-20 18:10:14 +00:00
{
return bool(InOpt);
}
//If a value for this variable was not specified in the launch command, return the original value.
return CurrentValue;
}
/**
2023-05-20 18:27:00 +00:00
*** @brief Gets a String from the launch command if available.
2023-05-20 18:10:14 +00:00
***
*** @param Options - options passed in via the launch command
*** @param ParseString - the variable we are looking for
*** @param CurrentValue - the current value of the variable
2023-05-20 18:27:00 +00:00
*** @return String value of the option we are looking for
2023-05-20 18:10:14 +00:00
***/
2023-05-20 18:27:00 +00:00
static public function String GetStringOption(String Options, String ParseString, String CurrentValue)
2023-05-20 18:10:14 +00:00
{
2023-05-20 18:27:00 +00:00
local String InOpt;
2023-05-20 18:10:14 +00:00
//Find the value associated with this variable in the launch command.
InOpt = GameInfo.static.ParseOption(Options, ParseString);
2023-05-20 18:27:00 +00:00
if (InOpt != "")
2023-05-20 18:10:14 +00:00
{
return InOpt;
}
//If a value for this variable was not specified in the launch command, return the original value.
return CurrentValue;
}
/**
*** @brief Gets a LogLevel from the launch command if available.
***
*** @param Options - options passed in via the launch command
*** @param ParseString - the variable we are looking for
*** @param CurrentValue - the current value of the variable
*** @return E_LogLevel value of the option we are looking for
***/
2023-05-20 18:27:00 +00:00
static public function E_LogLevel GetLogLevelOption(String Options, String ParseString, E_LogLevel CurrentValue)
2023-05-20 18:10:14 +00:00
{
2023-05-20 18:27:00 +00:00
local String InOpt;
//Find the value associated with this variable in the launch command.
InOpt = GameInfo.static.ParseOption(Options, ParseString);
if (InOpt != "")
{
return class'_Logger'.static.LogLevelFromString(InOpt, CurrentValue);
}
return CurrentValue;
2023-05-20 18:10:14 +00:00
}