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

Modernize board validity checking code #5467

Merged
merged 1 commit into from
May 16, 2024

Conversation

SJuliez
Copy link
Member

@SJuliez SJuliez commented May 13, 2024

This changes board/hex/terrain validation to use a list of error Strings instead of a StringBuffer. This way the resulting error list can be formatted as needed (usually with a String.join) at the receiver instead of being preformatted. Line breaks are unnecessary. Also shortens code as a separate validity boolean is not needed.
The list would also lend itself to using a report line class with more functionality than the simple String report line if we wanted that.
Also corrects a board with errors.
Also compacts terrain checking a bit and imports the Terrains.* constants in Terrain to simplify code.

Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@HammerGS HammerGS merged commit 97ab538 into MegaMek:master May 16, 2024
5 checks passed
HammerGS added a commit that referenced this pull request May 16, 2024
+ PR #5475: Updating Project Dependencies
+ PR #5470: Allow plain look and feel border for Megamek Button
+ PR #5467: Modernize board validity checking code
+ Fix #5465: Bay ammo correction
+ PR #5454: Option to not automatically select a unit for whenever a turn for me comes around
+ Fix #5452: AS advanced search and rear weapon conversion
@SJuliez SJuliez deleted the musing-validity-reporting branch May 17, 2024 14:47
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.

3 participants