Skip to content

Commit

Permalink
Merge pull request #1335 from MegaMek/industrial_afcs
Browse files Browse the repository at this point in the history
Restore option of advanced fire control for IndustrialMechs
  • Loading branch information
HammerGS authored Nov 16, 2023
2 parents b2d3c33 + 36c16d2 commit 5b82cf2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions megameklab/src/megameklab/ui/mek/BMChassisView.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void removeListener(MekBuildListener l) {
final private TechComboBox<EquipmentType> cbStructure = new TechComboBox<>(EquipmentType::getName);
final private TechComboBox<Engine> cbEngine = new TechComboBox<>(e -> e.getEngineName().replaceAll("^\\d+ ", ""));
final private CustomComboBox<Integer> cbGyro = new CustomComboBox<>(Mech::getGyroTypeShortString);
final private CustomComboBox<Integer> cbCockpit = new CustomComboBox<>(Mech::getCockpitTypeString);
final private CustomComboBox<Integer> cbCockpit = new CustomComboBox<>(i -> cockpitName(i, isIndustrial()));
final private TechComboBox<EquipmentType> cbEnhancement = new TechComboBox<>(EquipmentType::getName);
final private JCheckBox chkFullHeadEject = new JCheckBox();
final private JButton btnResetChassis = new JButton();
Expand All @@ -123,7 +123,7 @@ public void removeListener(MekBuildListener l) {
};

private static final int[] INDUSTRIAL_COCKPITS = {
Mech.COCKPIT_INDUSTRIAL, Mech.COCKPIT_COMMAND_CONSOLE, Mech.COCKPIT_TORSO_MOUNTED
Mech.COCKPIT_INDUSTRIAL, Mech.COCKPIT_STANDARD, Mech.COCKPIT_COMMAND_CONSOLE, Mech.COCKPIT_TORSO_MOUNTED
};

private static final String[] ENHANCEMENT_NAMES = {
Expand Down Expand Up @@ -554,6 +554,17 @@ private void refreshCockpit() {
cbCockpit.setSelectedIndex(0);
}
}

private static String cockpitName(int index, boolean industrial) {
if (industrial) {
if (index == Mech.COCKPIT_STANDARD) {
return Mech.getCockpitTypeString(Mech.COCKPIT_INDUSTRIAL) + " (Adv. FireCon)";
} else if (index == Mech.COCKPIT_PRIMITIVE) {
return Mech.getCockpitTypeString(Mech.COCKPIT_PRIMITIVE_INDUSTRIAL) + " (Adv. FireCon)";
}
}
return Mech.getCockpitTypeString(index);
}

private void refreshEnhancement() {
cbEnhancement.removeActionListener(this);
Expand Down

0 comments on commit 5b82cf2

Please sign in to comment.