From 0dd5bc6b7c635d69a7a389034c0e3eecd6a85919 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 25 Jan 2022 21:55:20 +0100 Subject: [PATCH 1/4] Issue #1012 Conv Fighter engine choices corrected --- .../com/ui/fighterAero/ASChassisView.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/megameklab/com/ui/fighterAero/ASChassisView.java b/src/megameklab/com/ui/fighterAero/ASChassisView.java index be671d500..0f5ef4b6c 100644 --- a/src/megameklab/com/ui/fighterAero/ASChassisView.java +++ b/src/megameklab/com/ui/fighterAero/ASChassisView.java @@ -294,24 +294,31 @@ public List getAvailableEngines() { flags |= Engine.LARGE_ENGINE; } int altFlags = flags ^ Engine.CLAN_ENGINE; - // Non-superheavies can use non-fusion engines under experimental rules for (int i : ENGINE_TYPES) { Engine e = new Engine(getEngineRating(), i, flags); - if (e.engineValid && (e.isFusion() || conventional) - && techManager.isLegal(e)) { + if (e.engineValid && techManager.isLegal(e) && (validCFEngine(e) || validASFEngine(e))) { retVal.add(e); } // Only add the opposite tech base if the engine is different. if (isMixed && e.getSideTorsoCriticalSlots().length > 0) { e = new Engine(getEngineRating(), i, altFlags); - if (e.engineValid && (e.isFusion() || conventional) - && techManager.isLegal(e)) { + if (e.engineValid && techManager.isLegal(e) && (validCFEngine(e) || validASFEngine(e))) { retVal.add(e); } } } return retVal; } + + private boolean validCFEngine(Engine engine) { + return conventional && ((engine.getEngineType() == Engine.NORMAL_ENGINE) + || (engine.getEngineType() == Engine.COMBUSTION_ENGINE) + || (engine.getEngineType() == Engine.XXL_ENGINE)); + } + + private boolean validASFEngine(Engine engine) { + return !conventional && engine.isFusion(); + } private void refreshCockpit() { cbCockpit.removeActionListener(this); From 8906ae1dccf0e0efb721208bb9430633cca84002 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 26 Jan 2022 09:34:49 +0100 Subject: [PATCH 2/4] Issue #1016 Always print CASE/CASEII in location header --- src/megameklab/com/printing/PrintMech.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/megameklab/com/printing/PrintMech.java b/src/megameklab/com/printing/PrintMech.java index 65128a6b0..e8e890774 100644 --- a/src/megameklab/com/printing/PrintMech.java +++ b/src/megameklab/com/printing/PrintMech.java @@ -426,8 +426,10 @@ private void writeLocationCriticals(int loc, SVGRectElement svgRect) { double x = viewX + viewWidth * 0.075; x += addTextElement(canvas, x, viewY - 1, mech.getLocationName(loc), fontSize * 1.25f, SVGConstants.SVG_START_VALUE, SVGConstants.SVG_BOLD_VALUE); - if (mech.isClan() && UnitUtil.hasAmmo(mech, loc) && !mech.hasCASEII(loc)) { - addTextElement(canvas, x + fontSize / 2, viewY - 1, "(CASE)", fontSize, + if ((mech.isClan() && UnitUtil.hasAmmo(mech, loc)) + || (!mech.isClan() && (mech.hasCASEII(loc) || mech.locationHasCase(loc)))) { + String text = "(CASE" + (mech.hasCASEII(loc) ? " II)" : ")"); + addTextElement(canvas, x + fontSize / 2, viewY - 1, text, fontSize, SVGConstants.SVG_START_VALUE, SVGConstants.SVG_NORMAL_VALUE); } From 0aaa563e19bef9693cb0c04976db209937eb9d8c Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 26 Jan 2022 09:39:37 +0100 Subject: [PATCH 3/4] Issue #1012 Anticipated errata (no XXL Engines for CF) --- src/megameklab/com/ui/fighterAero/ASChassisView.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/megameklab/com/ui/fighterAero/ASChassisView.java b/src/megameklab/com/ui/fighterAero/ASChassisView.java index 0f5ef4b6c..f79d2490e 100644 --- a/src/megameklab/com/ui/fighterAero/ASChassisView.java +++ b/src/megameklab/com/ui/fighterAero/ASChassisView.java @@ -312,8 +312,7 @@ public List getAvailableEngines() { private boolean validCFEngine(Engine engine) { return conventional && ((engine.getEngineType() == Engine.NORMAL_ENGINE) - || (engine.getEngineType() == Engine.COMBUSTION_ENGINE) - || (engine.getEngineType() == Engine.XXL_ENGINE)); + || (engine.getEngineType() == Engine.COMBUSTION_ENGINE)); } private boolean validASFEngine(Engine engine) { From f38554f1e101084b601ab6c387393111741c15b2 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 26 Jan 2022 10:29:35 +0100 Subject: [PATCH 4/4] Issue #1008 Set correct minimum size for variable size equip --- .../com/ui/combatVeh/CVEquipmentDatabaseView.java | 1 + .../com/ui/fighterAero/ASEquipmentDatabaseView.java | 1 + .../com/ui/largeAero/LAEquipmentDatabaseView.java | 1 + src/megameklab/com/ui/mek/BMEquipmentDatabaseView.java | 1 + .../com/ui/supportVeh/SVEquipmentDatabaseView.java | 1 + src/megameklab/com/util/UnitUtil.java | 10 ++++++++++ 6 files changed, 15 insertions(+) diff --git a/src/megameklab/com/ui/combatVeh/CVEquipmentDatabaseView.java b/src/megameklab/com/ui/combatVeh/CVEquipmentDatabaseView.java index ef9cddd9c..28dd30a25 100644 --- a/src/megameklab/com/ui/combatVeh/CVEquipmentDatabaseView.java +++ b/src/megameklab/com/ui/combatVeh/CVEquipmentDatabaseView.java @@ -51,6 +51,7 @@ protected void addEquipment(EquipmentType equip, int count) { } else { try { mount = new Mounted(getTank(), equip); + UnitUtil.setVariableSizeMiscTypeMinimumSize(mount); int loc = Entity.LOC_NONE; if (isMisc && equip.hasFlag(MiscType.F_MAST_MOUNT)) { loc = VTOL.LOC_ROTOR; diff --git a/src/megameklab/com/ui/fighterAero/ASEquipmentDatabaseView.java b/src/megameklab/com/ui/fighterAero/ASEquipmentDatabaseView.java index 03cb0d4b6..e780a0106 100644 --- a/src/megameklab/com/ui/fighterAero/ASEquipmentDatabaseView.java +++ b/src/megameklab/com/ui/fighterAero/ASEquipmentDatabaseView.java @@ -49,6 +49,7 @@ protected void addEquipment(EquipmentType equip, int count) { } else { try { Mounted mount = new Mounted(getAero(), equip); + UnitUtil.setVariableSizeMiscTypeMinimumSize(mount); int location = (equip instanceof AmmoType) ? Aero.LOC_FUSELAGE : Aero.LOC_NONE; getAero().addEquipment(mount, location, false); if ((equip instanceof WeaponType) && equip.hasFlag(WeaponType.F_ONESHOT)) { diff --git a/src/megameklab/com/ui/largeAero/LAEquipmentDatabaseView.java b/src/megameklab/com/ui/largeAero/LAEquipmentDatabaseView.java index aa313fe05..d53a2f851 100644 --- a/src/megameklab/com/ui/largeAero/LAEquipmentDatabaseView.java +++ b/src/megameklab/com/ui/largeAero/LAEquipmentDatabaseView.java @@ -72,6 +72,7 @@ protected void addEquipment(EquipmentType equip, int count) { try { for (int i = 0; i < count; i++) { mount = new Mounted(getAero(), equip); + UnitUtil.setVariableSizeMiscTypeMinimumSize(mount); getAero().addEquipment(mount, Entity.LOC_NONE, false); if ((equip instanceof WeaponType) && equip.hasFlag(WeaponType.F_ONESHOT)) { UnitUtil.removeOneShotAmmo(eSource.getEntity()); diff --git a/src/megameklab/com/ui/mek/BMEquipmentDatabaseView.java b/src/megameklab/com/ui/mek/BMEquipmentDatabaseView.java index a974204b3..b3b19081b 100644 --- a/src/megameklab/com/ui/mek/BMEquipmentDatabaseView.java +++ b/src/megameklab/com/ui/mek/BMEquipmentDatabaseView.java @@ -52,6 +52,7 @@ protected void addEquipment(EquipmentType equip, int count) { } else { try { mount = new Mounted(getMech(), equip); + UnitUtil.setVariableSizeMiscTypeMinimumSize(mount); getMech().addEquipment(mount, Entity.LOC_NONE, false); if ((equip instanceof WeaponType) && equip.hasFlag(WeaponType.F_ONESHOT)) { UnitUtil.removeOneShotAmmo(eSource.getEntity()); diff --git a/src/megameklab/com/ui/supportVeh/SVEquipmentDatabaseView.java b/src/megameklab/com/ui/supportVeh/SVEquipmentDatabaseView.java index f8c2b2ccb..ed5defdc5 100644 --- a/src/megameklab/com/ui/supportVeh/SVEquipmentDatabaseView.java +++ b/src/megameklab/com/ui/supportVeh/SVEquipmentDatabaseView.java @@ -71,6 +71,7 @@ protected void addEquipment(EquipmentType equip, int count) { } for (int i = 0; i < count; i++) { mount = new Mounted(eSource.getEntity(), equip); + UnitUtil.setVariableSizeMiscTypeMinimumSize(mount); if ((eSource.getEntity().isFighter() && (equip instanceof MiscType)) && equip.hasFlag(MiscType.F_BLUE_SHIELD)) { getAero().addEquipment(mount, Aero.LOC_FUSELAGE, false); diff --git a/src/megameklab/com/util/UnitUtil.java b/src/megameklab/com/util/UnitUtil.java index 09b413a1e..b4fad6476 100644 --- a/src/megameklab/com/util/UnitUtil.java +++ b/src/megameklab/com/util/UnitUtil.java @@ -4464,5 +4464,15 @@ public static void setManualBV(int manualBV, Entity entity) { entity.setUseManualBV(manualBV > 0); } + /** + * For MiscTypes of variable size such as Ladders this sets the size to the minimum + * size which is equal to the step size (20m for Ladders, 0.5t for Cargo space and the like). + */ + public static void setVariableSizeMiscTypeMinimumSize(Mounted mounted) { + if ((mounted.getType() instanceof MiscType) && mounted.getType().isVariableSize()) { + mounted.setSize(mounted.getType().variableStepSize()); + } + } + }