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

Fix for request 5333 - Add Gunnery / Pilot BV values to the unit selection screen. #5334

Merged
merged 4 commits into from
Apr 20, 2024

Conversation

TenkawaBC
Copy link
Contributor

Add Gunnery / Piloting values to the unit selection screen, and adjust BV accordingly. PV uses the Gunnery box only.

This fixes issue 5333

Add Gunnery / Piloting values to the unit selection screen, and adjust BV accordingly.
PV uses the Gunnery box only.

This fixes issue 5333
int gunnery = 4;
double modifier = 1;
if (textGunnery.getText().matches("\\d+")) {
gunnery = Integer.parseInt(textGunnery.getText());

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The .matches line above it is a validation that it is a number before it goes to the parsing

…t BV accordingly.

PV uses the Gunnery box only.

This fixes issue 5333

Updated with documentation and limits on the Gunnery/Pilot values.
int gunnery = 4;
int piloting = 5;
if (textGunnery.getText().matches("\\d+")) {
gunnery = Integer.parseInt(textGunnery.getText());

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
};
};
if (textPilot.getText().matches("\\d+")) {
piloting = Integer.parseInt(textPilot.getText());

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
…t BV accordingly.

PV uses the Gunnery box only.

This fixes issue 5333

Updated with documentation and limits on the Gunnery/Pilot values.

Optioned in Client Settings now.
Known issue: After enabling/disabling, MM must be restarted for the change to take effect.
…t BV accordingly.

PV uses the Gunnery box only.

This fixes issue 5333

Updated with documentation and limits on the Gunnery/Pilot values.

Optioned in Client Settings now.
Known issue: After enabling/disabling, MM must be restarted for the change to take effect.
@TenkawaBC
Copy link
Contributor Author

Updated to be hidden behind a Client Settings option (Off by default). Turning it on or off requires restart of Megamek to apply.

Tooltip added to the Client Settings option.
Additional validation added to the Gunnery/Piloting to not allow values over 8 (defaults back to 4 (gunnery) / 5 (piloting) ).
When PV is selected, the Gunnery value is used for the skill. Supported values 0-8 (else defaults to 4).

@HammerGS HammerGS added the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label Apr 10, 2024
@SJuliez SJuliez merged commit 5110a1d into MegaMek:master Apr 20, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For New Dev Cycle This PR should be merged at the beginning of a dev cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants