Changed how the TryParse function works (and also did some general cleanup along the way)

This commit is contained in:
jadebenn
2024-02-02 17:50:30 -06:00
parent d78b50874c
commit 4f75479a4c
34 changed files with 506 additions and 535 deletions

View File

@@ -27,19 +27,15 @@ MissionTask::MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask)
std::string token;
while (std::getline(stream, token, ',')) {
uint32_t parameter;
if (GeneralUtils::TryParse(token, parameter)) {
parameters.push_back(parameter);
}
const auto parameter = GeneralUtils::TryParse<uint32_t>(token);
if (parameter) parameters.push_back(parameter.value());
}
stream = std::istringstream(info->targetGroup);
while (std::getline(stream, token, ',')) {
uint32_t parameter;
if (GeneralUtils::TryParse(token, parameter)) {
targets.push_back(parameter);
}
const auto parameter = GeneralUtils::TryParse<uint32_t>(token);
if (parameter) targets.push_back(parameter.value());
}
}