Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Change TryParse implementation #1442

Merged
merged 26 commits into from
Feb 10, 2024

Conversation

jadebenn
Copy link
Collaborator

@jadebenn jadebenn commented Feb 2, 2024

Changed the TryParse function to use from_chars(), natively handle enums, and have a better syntax. Also did some cleanup along the way, particularly regarding the function declarations of QuickbuildComponent.h.

Need to see how these changes compile on the other platforms, but have had good experience testing on my own.

@jadebenn jadebenn marked this pull request as ready for review February 3, 2024 00:07
@EmosewaMC
Copy link
Collaborator

EmosewaMC commented Feb 3, 2024

Can you elaborate on general cleanup?

@jadebenn
Copy link
Collaborator Author

jadebenn commented Feb 3, 2024

Can you elaborate on general cleanup?

I can try and split out the unrelated changes later. It's kind of hard because I tend to notice and address issues as I'm working on a primary goal, but it isn't good practice to mix them up I agree.

For the most part, they're really minor. A few [[nodiscard]] tags here, a few consts there... that sort of thing.

@EmosewaMC
Copy link
Collaborator

EmosewaMC commented Feb 3, 2024

For the most part, they're really minor. A few [[nodiscard]] tags here, a few consts there... that sort of thing.

Just as a note, we wont be enforcing nodiscard as an attribute in any prs, nor will we be requiring it for apis. Nothing against adding them, just wont be enforcing it

@jadebenn
Copy link
Collaborator Author

jadebenn commented Feb 3, 2024

For the most part, they're really minor. A few [[nodiscard]] tags here, a few consts there... that sort of thing.

Just as a note, we wont be enforcing nodiscard as an attribute in any prs, nor will we be requiring it for apis. Nothing against adding them, just wont be enforcing it

Didn't expect any different, just trying to do my part for keeping code intentions clear.

As far as the failed CI, I suspected that it wouldn't work on MacOS given our previous conversations, so I actually have the fallback floating point code ready to go (just commented out). I much prefer from_chars though, so I'll probably wrap it in a pre-processor block so it is ONLY present on Mac.

One neat thing is that the way the concept resolution works, I don't actually need to change anything in the other templates to make floating points switch over: They see the more specific constraint and immediately start using that one. At least, this is the behavior I saw on my end.

@EmosewaMC
Copy link
Collaborator

how has this been tested?

Copy link
Collaborator

@EmosewaMC EmosewaMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am only reviewing the GeneralUtils.h header for now until the other unrelated changes are reverted. There are a lot of unrelated changes here which make the pr much larger to review than it needs to be

dCommon/GeneralUtils.h Outdated Show resolved Hide resolved
dCommon/GeneralUtils.h Outdated Show resolved Hide resolved
dCommon/GeneralUtils.h Outdated Show resolved Hide resolved
dCommon/GeneralUtils.h Outdated Show resolved Hide resolved
dCommon/GeneralUtils.h Show resolved Hide resolved
dCommon/GeneralUtils.h Outdated Show resolved Hide resolved
dCommon/GeneralUtils.h Outdated Show resolved Hide resolved
@jadebenn
Copy link
Collaborator Author

jadebenn commented Feb 3, 2024

how has this been tested?

I've run around VE, AG, and Ninjago completing missions and playing normally for about 90 minutes and haven't noticed anything strange with the Ubuntu build.

@jadebenn
Copy link
Collaborator Author

jadebenn commented Feb 3, 2024

I am only reviewing the GeneralUtils.h header for now until the other unrelated changes are reverted. There are a lot of unrelated changes here which make the pr much larger to review than it needs to be

I don't think there were very many? I had to do a lot of changes relating to the actual TryParse invocations, but aside from QuickbuildComponent (which I will split out sometime tomorrow) it was pretty much just tossing a few 'consts' on things I saw that didn't need to be mutable. Even QuickbuildComponent was just adjusting for const correctness, attrib tagging, and marking noexcept.

@jadebenn
Copy link
Collaborator Author

jadebenn commented Feb 3, 2024

Ah, forgot about dCommonVars.h. I see what you mean a bit better now.

@EmosewaMC
Copy link
Collaborator

I am only reviewing the GeneralUtils.h header for now until the other unrelated changes are reverted. There are a lot of unrelated changes here which make the pr much larger to review than it needs to be

I don't think there were very many? I had to do a lot of changes relating to the actual TryParse invocations, but aside from QuickbuildComponent (which I will split out sometime tomorrow) it was pretty much just tossing a few 'consts' on things I saw that didn't need to be mutable. Even QuickbuildComponent was just adjusting for const correctness, attrib tagging, and marking noexcept.

In the future we'd appreciate isolated pr changes for things that are very much not related.

@EmosewaMC
Copy link
Collaborator

Yeah commonvars.h is the main one I was looking at. With those being really compiler only changes they would be better suited in their own pr, but if you don't want to move them now it's fine, just will take more time to review

@jadebenn jadebenn changed the title chore: Change how the TryParse function works (and also some general cleanup) chore: Change how the TryParse function works Feb 3, 2024
@jadebenn jadebenn changed the title chore: Change how the TryParse function works refactor: Change how the TryParse function works Feb 3, 2024
@jadebenn jadebenn changed the title refactor: Change how the TryParse function works refactor: Change TryParse implementation Feb 3, 2024
dCommon/GeneralUtils.h Outdated Show resolved Hide resolved
dGame/dComponents/TriggerComponent.cpp Outdated Show resolved Hide resolved
dGame/dComponents/TriggerComponent.cpp Outdated Show resolved Hide resolved
dGame/dComponents/TriggerComponent.cpp Outdated Show resolved Hide resolved
dGame/dComponents/TriggerComponent.cpp Outdated Show resolved Hide resolved
dGame/dInventory/Item.cpp Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
dMasterServer/InstanceManager.cpp Outdated Show resolved Hide resolved
dNet/AuthPackets.cpp Outdated Show resolved Hide resolved
dScripts/02_server/Map/AM/AmSkullkinTower.cpp Outdated Show resolved Hide resolved
dZoneManager/Level.cpp Outdated Show resolved Hide resolved
@jadebenn
Copy link
Collaborator Author

jadebenn commented Feb 4, 2024

Actually, no I'm not going to rename that variable with the m_ prefix. That would need to be a PR of its own because it creates so many problems. I will be reverting my commits to that effect.

@jadebenn
Copy link
Collaborator Author

jadebenn commented Feb 4, 2024

okay pinky swear that is It. I will resist the urge to add anything more unless the CI fails again

dNet/AuthPackets.cpp Outdated Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
dGame/dUtilities/SlashCommandHandler.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@EmosewaMC EmosewaMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending ci

@aronwk-aaron aronwk-aaron merged commit 0c1ee05 into DarkflameUniverse:main Feb 10, 2024
4 checks passed
@jadebenn jadebenn deleted the TryParseChanges branch February 10, 2024 16:06
jadebenn added a commit that referenced this pull request Feb 11, 2024
* 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 bf318ca.

* Fully revert renaming attempt

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

This reverts commit bf318ca.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants