refactor: Change TryParse implementation (#1442)

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

* Update noexcept attributes (verified these are correct)

* Add fp overload for MacOS functionality

* resolving some feedback

* Split out unrelated changes to CleanupRoundup branch

* Update in response to feedback

* the consequences of emo's member variable renaming request

* Revert "the consequences of emo's member variable renaming request"

This reverts commit bf318caeda.

* Fully revert renaming attempt

* Revert "the consequences of emo's member variable renaming request"

This reverts commit bf318caeda.

Fully revert renaming attempt

* Created ClientVersion.h and moved the client version defaults to it

* Fix partial parsing and MacOS floating point errors

* attempting fix to MacOS compiler error

* syntax pass (should be the last commit unless the CI fails)

* ah, wait, forgot to uncomment the preprocessor statements for MacOS. THIS should be the last commit pending CI

* Okay, one last thing I noticed: We were including C headers here. Now they're C++ headers. Pinky swear this is it!

* typo and I am OCD. please let this be the last

* hash is usally but not always noexcept, so the specifier should go

* Address MOST of the feedback

* address the claim codes issue
This commit is contained in:
jadebenn
2024-02-10 05:05:25 -06:00
committed by GitHub
parent 62b670d283
commit 0c1ee0513d
33 changed files with 463 additions and 453 deletions

View File

@@ -33,14 +33,12 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
int32_t pipeNum = 0;
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum)) {
return;
}
const auto pipeNum = GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1));
if (!pipeNum) return;
const auto pipeGroup = myGroup.substr(0, 10);
const auto nextPipeNum = pipeNum + 1;
const auto nextPipeNum = pipeNum.value() + 1;
const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup);
@@ -70,11 +68,9 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
}
void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
const auto* const quickBuildComponent = self->GetComponent<QuickBuildComponent>();
if (quickBuildComponent == nullptr) {
return;
}
if (!quickBuildComponent) return;
if (timerName == "reset" && quickBuildComponent->GetState() == eQuickBuildState::OPEN) {
self->Smash(self->GetObjectID(), eKillType::SILENT);

View File

@@ -144,13 +144,10 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
);
for (const auto& mission : missions) {
int32_t missionID = 0;
const auto missionID = GeneralUtils::TryParse<int32_t>(mission);
if (!missionID) continue;
if (!GeneralUtils::TryParse(mission, missionID)) {
continue;
}
missionIDs.push_back(missionID);
missionIDs.push_back(missionID.value());
}
}

View File

@@ -12,12 +12,9 @@ void AmTemplateSkillVolume::OnSkillEventFired(Entity* self, Entity* caster, cons
const auto missionIDs = GeneralUtils::SplitString(missionIDsVariable, '_');
for (const auto& missionIDStr : missionIDs) {
int32_t missionID = 0;
const auto missionID = GeneralUtils::TryParse<uint32_t>(missionIDStr);
if (!missionID) continue;
if (!GeneralUtils::TryParse(missionIDStr, missionID)) {
continue;
}
missionComponent->ForceProgressTaskType(missionID, 1, 1, false);
missionComponent->ForceProgressTaskType(missionID.value(), 1, 1, false);
}
}