-
Couldn't load subscription status.
- Fork 198
Improvement: Convert Skill Type Storage from Array to Enum #7633
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
base: main
Are you sure you want to change the base?
Conversation
… Level is Important
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
| public boolean isRightTechType(String skillType) { | ||
| if (getEngine().hasFlag(Engine.TANK_ENGINE)) { | ||
| return skillType.equals(SkillType.S_TECH_MECHANIC); | ||
| return skillType.equals(SkillTypeNew.S_TECH_MECHANIC.name()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll see a lot of SkillTypeNew.SKILL.name() in this PR. The original SkillType format had all skill references using a static String. That means our codebase is set up to accept Strings and not SkillTypes.
One of my goals with this PR was to make as few changes as possible, to reduce the risk of introducing new bugs with this overhaul. While converting the codebase to use SkillTypes wherever possible would be the correct move, it would balloon the size of this PR beyond reasonable levels. It is better, then, to use legacy architecture that can be replaced ad hoc in future PRs.
# Conflicts: # MekHQ/src/mekhq/campaign/personnel/Person.java # MekHQ/src/mekhq/campaign/personnel/generator/AbstractSkillGenerator.java # MekHQ/src/mekhq/campaign/personnel/skills/Skill.java # MekHQ/src/mekhq/campaign/personnel/skills/SkillType.java
This PR relates to the conversion of our current SkillType class from a static String plus hash hybrid and into an enum.
This makes it far easier for developers to add new skills and make changes to existing skills. It makes skill storage more reliable and removes the risk that a skill change will result in damage to a players' save.