Skip to content

Commit

Permalink
add CRIT_SENSOR_MAX
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Jul 30, 2023
1 parent ccc98ae commit 221d348
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions megamek/src/megamek/client/ui/swing/UnitEditorDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ private void setupTankSystemPanel() {
gridBagConstraints.weightx = 0.0;
panSystem.add(new JLabel("<html><b>" + Messages.getString("UnitEditorDialog.sensor") + "</b><br></html>"),
gridBagConstraints);
sensorCrit = new CheckCritPanel(4, tank.getSensorHits());
sensorCrit = new CheckCritPanel(Tank.CRIT_SENSOR_MAX, tank.getSensorHits());
gridBagConstraints.gridx = 1;
gridBagConstraints.weightx = 1.0;
panSystem.add(sensorCrit, gridBagConstraints);
Expand Down Expand Up @@ -786,7 +786,7 @@ private void setupVtolSystemPanel() {
gridBagConstraints.weightx = 0.0;
panSystem.add(new JLabel("<html><b>" + Messages.getString("UnitEditorDialog.sensor") + "</b><br></html>"),
gridBagConstraints);
sensorCrit = new CheckCritPanel(4, vtol.getSensorHits());
sensorCrit = new CheckCritPanel(Tank.CRIT_SENSOR_MAX, vtol.getSensorHits());
gridBagConstraints.gridx = 1;
gridBagConstraints.weightx = 1.0;
panSystem.add(sensorCrit, gridBagConstraints);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private static StringBuilder sysEngineHit(Tank tank, String locAbbr) {

private static StringBuilder sysSensorHit(Tank tank, String locAbbr) {
String result = "";
int total = 4;
int total = Tank.CRIT_SENSOR_MAX;
int hits = tank.getSensorHits();
int good = total - hits;
boolean bad = hits > 0;
Expand Down
4 changes: 3 additions & 1 deletion megamek/src/megamek/common/Tank.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public class Tank extends Entity {
public static final int CRIT_TURRET_LOCK = 13;
public static final int CRIT_TURRET_DESTROYED = 14;

public static final int CRIT_SENSOR_MAX = 4;

//Fortify terrain just like infantry
public static final int DUG_IN_NONE = 0;
public static final int DUG_IN_FORTIFYING1 = 1;
Expand Down Expand Up @@ -1873,7 +1875,7 @@ public int getCriticalEffect(int roll, int loc, boolean damagedByFire) {
}
}
case 9:
if (getSensorHits() < 4) {
if (getSensorHits() < CRIT_SENSOR_MAX) {
return CRIT_SENSOR;
}
case 10:
Expand Down

0 comments on commit 221d348

Please sign in to comment.