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

numbers aren't magic #2976

Merged
merged 4 commits into from Jun 9, 2023

Conversation

briaguya-ai
Copy link
Contributor

@briaguya-ai briaguya-ai commented Jun 9, 2023

did a big search for all the comboboxes using magic numbers and threw some enums in them

i also found a typo and fixed that in a few places

i also did a little logic cleanup in a couple places to make things read more clearly with the enum values

very open to naming suggestions and ideas about where these new enums should live

Build Artifacts

Copy link
Contributor

@aMannus aMannus left a comment

Choose a reason for hiding this comment

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

Very nice! Couple of suggestions from me.

soh/soh/Enhancements/enhancementTypes.h Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Overall, I am onboard. I wonder if we should add a little more specificity to the enum names. I'm thinking similar to how our randomizer options are all RO_XXX, we could for example have all the enhancement options here be prefixed with EO_XXX

Granted there are more enums in this PR than just this file, but just throwing out ideas to help with the namespace of things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm down to set the pattern of EO_ for things in this file, not sure how best to handle the things beyond this one though (maybe those can be a future problem if we can't think of something good?)

Copy link
Contributor

Choose a reason for hiding this comment

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

I disagree, I think these are fine as is since they are already being prefaced with the option they are enumerating for. I think the initial EO might just add extra noise to autocomplete stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

My concern is less with identifying the option name, and more so with "specificity" in the include/header space to help avoid collisions, especially as this file will grow when more enhancements are added. Again just a suggestion, I won't die on the hill over it.

(The pattern is used both in the original game code for enums, and some of our own existing enums)

Copy link
Contributor

Choose a reason for hiding this comment

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

Were the enums actually in the original game code or is that decomp documentation? Anyway, I don't disagree with the specificity and pattern points, I just think that having the option name in the enums is enough to satisfy those points without the EO prefix. I also won't die on this hill though, adding EO is fine with me if bria thinks it's better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't have strong feelings one way or the other, i just want to not have magic numbers

Copy link
Contributor

Choose a reason for hiding this comment

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

I honestly don't think the prefix is necessary, either. If you really want to do specificity, then you could separate the enums into separate headers per group, but I also think the name of the option being in the enum value names is enough distinction between the enums themselves. Maybe in the enum name instead of the value names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds like there are more people in the "don't add the EO prefix" camp at the moment. we can revisit that decision later if we want to, i'm happy without it for now

briaguya added 3 commits June 9, 2023 15:03
renamed everything except the cvar itself at this point
(waiting for versioned configs for that)
Copy link
Contributor

@leggettc18 leggettc18 left a comment

Choose a reason for hiding this comment

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

I'm in favor of this as is, without the EO prefix on the enhancement option enums.

@leggettc18 leggettc18 merged commit d69c07c into HarbourMasters:develop Jun 9, 2023
8 checks passed
@garrettjoecox garrettjoecox added this to the Sulu (7.1.x) milestone Jun 13, 2023
@briaguya-ai briaguya-ai deleted the numbers-arent-magic branch June 15, 2023 22:50
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

6 participants