Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@IllianiBird
Copy link
Collaborator

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.

@IllianiBird IllianiBird self-assigned this Oct 4, 2025
@IllianiBird IllianiBird requested a review from a team as a code owner October 4, 2025 02:09
@IllianiBird IllianiBird added the Legacy Improvement Improves a legacy setup's handling. label Oct 4, 2025
@IllianiBird IllianiBird marked this pull request as draft October 4, 2025 02:10
Copy link

@github-advanced-security github-advanced-security bot left a 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());
Copy link
Collaborator Author

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

Labels

For New Dev Cycle Legacy Improvement Improves a legacy setup's handling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant