Stringify Randomizer Enums#6223
Open
xxAtrain223 wants to merge 4 commits intoHarbourMasters:developfrom
Open
Conversation
Contributor
|
seems relevant to #6205 |
serprex
approved these changes
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the Randomizer Enums from
randomizerTypes.hinto separate files so they can be stringified.There are a few different ways to do this, I chose this method to keep the enum definition co-located with the enum values.
One of the other ways to do this is with this pattern:
This setup would expand to something like this:
The way I have this implemented in this PR is like this:
This setup would expand to something like this:
Both of these methods (and more) can achieve the same result. The reason I didn't choose the first pattern is because either all enum values need to be defined in separate files, or each of the enum values need to have different macros so they can be selectively defined where it's used. I chose the second pattern to try and get the best of both worlds, but it's still not perfect. The same macros are used for all enums, the entire enum definition is kept together, each enum can be in separate files or in shared files, but the selectively choosing an enum in a shared file (or the main include) requires creative macro definition overrides like the following.
So if a specific enum is needed for additional operations, then it'll be easier to move the enum into it's own file and included in
randomizerEnums.h.I've created a couple initial enum<=>string functions to show how macros can be redefined.
Build Artifacts