Skip to content

Commit

Permalink
Merge pull request #1669 from Sleet01/MML_1667_incorrect_cargo_bay_mi…
Browse files Browse the repository at this point in the history
…nimum_doors_mml

Fix MML #1667: incorrect cargo bay minimum doors (MML side)
  • Loading branch information
Sleet01 authored Dec 27, 2024
2 parents 543ecc9 + 3cd0bbe commit bedf027
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions megameklab/src/megameklab/ui/generalUnit/TransportTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ private boolean canAddSelectedBay() {
return false;
}
BayData bayType = modelAvailable.getBayType(tblAvailable.convertRowIndexToModel(selected));
return (doorsAvailable() > 0) || bayType.isInfantryBay();
return (doorsAvailable() >= bayType.getMinDoors());
}

/**
Expand Down Expand Up @@ -867,7 +867,10 @@ public void stateChanged(ChangeEvent e) {
refreshDockingHardpoints();

} else if (column == InstalledBaysModel.COL_DOORS) {
modelInstalled.bayList.get(row).setDoors((Integer) getCellEditorValue());
int value = (Integer) getCellEditorValue();
modelInstalled.bayList.get(row).setDoors(
Math.max(value, bay.getMinDoors())
);
}
modelInstalled.fireTableRowsUpdated(row, row);
checkButtons();
Expand All @@ -886,7 +889,7 @@ public Component getTableCellEditorComponent(JTable table, Object value, boolean
if (column == InstalledBaysModel.COL_DOORS) {
int doors = (Integer) modelInstalled.getValueAt(row, column);
SpinnerNumberModel model = new SpinnerNumberModel(doors,
(isInfantry) ? 0 : 1,
modelInstalled.bayList.get(row).getMinDoors(),
getEntity().isAero() ? doorsAvailable() + doors : Integer.MAX_VALUE, 1);
spinner.removeChangeListener(this);
spinner.setModel(model);
Expand Down

0 comments on commit bedf027

Please sign in to comment.