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 MML #1667: incorrect cargo bay minimum doors (MML side) #1669

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading