From 80575b4f83a94a4c22e6089c5a68865e05c7ee3d Mon Sep 17 00:00:00 2001 From: sleet01 Date: Thu, 26 Dec 2024 16:30:58 -0800 Subject: [PATCH 1/2] Get min door sizes from installed bay types and fix default door nums --- megameklab/src/megameklab/ui/generalUnit/TransportTab.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megameklab/src/megameklab/ui/generalUnit/TransportTab.java b/megameklab/src/megameklab/ui/generalUnit/TransportTab.java index 2b09b0e4c..194d50ce2 100644 --- a/megameklab/src/megameklab/ui/generalUnit/TransportTab.java +++ b/megameklab/src/megameklab/ui/generalUnit/TransportTab.java @@ -886,7 +886,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); From 3cd0bbe5a5a17e6bd337664ff414b586f1672936 Mon Sep 17 00:00:00 2001 From: sleet01 Date: Thu, 26 Dec 2024 17:25:48 -0800 Subject: [PATCH 2/2] Convert spinners to use actual Bay minDoors values --- megameklab/src/megameklab/ui/generalUnit/TransportTab.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/megameklab/src/megameklab/ui/generalUnit/TransportTab.java b/megameklab/src/megameklab/ui/generalUnit/TransportTab.java index 194d50ce2..398a4d391 100644 --- a/megameklab/src/megameklab/ui/generalUnit/TransportTab.java +++ b/megameklab/src/megameklab/ui/generalUnit/TransportTab.java @@ -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()); } /** @@ -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();