mirror of
https://github.com/ENSL/NS.git
synced 2024-11-24 21:41:17 +00:00
Removed exception handling from bot config
* Removed all try/catch clauses due to build issues
This commit is contained in:
parent
09a9b4870f
commit
4efd22b709
1 changed files with 28 additions and 170 deletions
|
@ -189,8 +189,6 @@ void CONFIG_ParseConfigFile()
|
|||
auto marineSize = teamSizes.substr(0, sizeDelimiterPos);
|
||||
auto alienSize = teamSizes.substr(sizeDelimiterPos + 1);
|
||||
|
||||
try
|
||||
{
|
||||
int iMarineSize = atoi(marineSize.c_str());
|
||||
int iAlienSize = atoi(alienSize.c_str());
|
||||
|
||||
|
@ -199,17 +197,6 @@ void CONFIG_ParseConfigFile()
|
|||
TeamSizeMap[mapName].TeamASize = atoi(marineSize.c_str());
|
||||
TeamSizeMap[mapName].TeamBSize = atoi(alienSize.c_str());
|
||||
}
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid team size setting. Team sizes must 'x/y' where x and y are valid numbers between 0 and 32\n", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid team size setting. Team sizes must 'x/y' where x and y are valid numbers between 0 and 32\n", value.c_str());
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -222,43 +209,18 @@ void CONFIG_ParseConfigFile()
|
|||
}
|
||||
|
||||
if (!stricmp(keyChar, "BotFillTiming"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int FillSetting = atoi(value.c_str());
|
||||
FillSetting = clampi(FillSetting, 0, 2);
|
||||
CurrentBotFillTiming = (BotFillTiming)FillSetting;
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid number. BotFillTiming must be a number between 0 and 2 inclusive\n", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid number. BotFillTiming must be a number between 0 and 2 inclusive\n", value.c_str());
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!stricmp(keyChar, "BotSkillLevel") || !stricmp(keyChar, "BotSkillName"))
|
||||
{
|
||||
try
|
||||
{
|
||||
CurrSkillIndex = std::stoi(value.c_str());
|
||||
CurrSkillIndex = clampi(CurrSkillIndex, 0, 3);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill level. Bot skill level must be a number between 0 and 3 inclusive.", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill level. Bot skill level must be a number between 0 and 3 inclusive.", value.c_str());
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -266,24 +228,11 @@ void CONFIG_ParseConfigFile()
|
|||
if (!stricmp(keyChar, "MarineReactionTime"))
|
||||
{
|
||||
if (CurrSkillIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
float NewValue = std::stof(value.c_str());
|
||||
|
||||
BotSkillLevels[CurrSkillIndex].marine_bot_reaction_time = clampf(NewValue, 0.0f, 1.0f);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bSkillLevelWarningGiven)
|
||||
|
@ -298,24 +247,11 @@ void CONFIG_ParseConfigFile()
|
|||
if (!stricmp(keyChar, "AlienReactionTime"))
|
||||
{
|
||||
if (CurrSkillIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
float NewValue = std::stof(value.c_str());
|
||||
|
||||
BotSkillLevels[CurrSkillIndex].alien_bot_reaction_time = clampf(NewValue, 0.0f, 1.0f);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bSkillLevelWarningGiven)
|
||||
|
@ -331,24 +267,11 @@ void CONFIG_ParseConfigFile()
|
|||
if (!stricmp(keyChar, "MarineAimSkill"))
|
||||
{
|
||||
if (CurrSkillIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
float NewValue = std::stof(value.c_str());
|
||||
|
||||
BotSkillLevels[CurrSkillIndex].marine_bot_aim_skill = clampf(NewValue, 0.0f, 1.0f);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_logged, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_logged, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bSkillLevelWarningGiven)
|
||||
|
@ -364,24 +287,11 @@ void CONFIG_ParseConfigFile()
|
|||
if (!stricmp(keyChar, "AlienAimSkill"))
|
||||
{
|
||||
if (CurrSkillIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
float NewValue = std::stof(value.c_str());
|
||||
|
||||
BotSkillLevels[CurrSkillIndex].alien_bot_aim_skill = clampf(NewValue, 0.0f, 1.0f);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bSkillLevelWarningGiven)
|
||||
|
@ -397,24 +307,11 @@ void CONFIG_ParseConfigFile()
|
|||
if (!stricmp(keyChar, "MarineMovementTracking"))
|
||||
{
|
||||
if (CurrSkillIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
float NewValue = std::stof(value.c_str());
|
||||
|
||||
BotSkillLevels[CurrSkillIndex].marine_bot_motion_tracking_skill = clampf(NewValue, 0.0f, 1.0f);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bSkillLevelWarningGiven)
|
||||
|
@ -430,24 +327,11 @@ void CONFIG_ParseConfigFile()
|
|||
if (!stricmp(keyChar, "AlienMovementTracking"))
|
||||
{
|
||||
if (CurrSkillIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
float NewValue = std::stof(value.c_str());
|
||||
|
||||
BotSkillLevels[CurrSkillIndex].alien_bot_motion_tracking_skill = clampf(NewValue, 0.0f, 1.0f);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bSkillLevelWarningGiven)
|
||||
|
@ -463,24 +347,11 @@ void CONFIG_ParseConfigFile()
|
|||
if (!stricmp(keyChar, "MarineViewSpeed"))
|
||||
{
|
||||
if (CurrSkillIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
float NewValue = std::stof(value.c_str());
|
||||
|
||||
BotSkillLevels[CurrSkillIndex].marine_bot_view_speed = clampf(NewValue, 0.0f, 5.0f);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bSkillLevelWarningGiven)
|
||||
|
@ -496,24 +367,11 @@ void CONFIG_ParseConfigFile()
|
|||
if (!stricmp(keyChar, "AlienViewSpeed"))
|
||||
{
|
||||
if (CurrSkillIndex > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
float NewValue = std::stof(value.c_str());
|
||||
|
||||
BotSkillLevels[CurrSkillIndex].alien_bot_view_speed = clampf(NewValue, 0.0f, 5.0f);
|
||||
}
|
||||
catch (std::invalid_argument const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
catch (std::out_of_range const& ex)
|
||||
{
|
||||
(void)ex;
|
||||
ALERT(at_console, "'%s' is not a valid skill setting. Bot skill settings should be a float. See nsbots.ini for more info", value.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bSkillLevelWarningGiven)
|
||||
|
|
Loading…
Reference in a new issue