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

Skip to content

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

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

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

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException

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
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