diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2992eea738..635129ff4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: steps: # Checkout the Pull Request source and put it in: ./mekhq - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: mekhq @@ -71,7 +71,7 @@ jobs: # Checkout the latest MegaMek source and put it in: ./megamek - name: Checkout MegaMek - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # repository: ${{ steps.find_mm.outputs.mmRepo }} # ref: ${{ steps.find_mm.outputs.mmBranch }} @@ -107,7 +107,7 @@ jobs: # Checkout the latest MegaMekLab source and put it in: ./megameklab - name: Checkout MegaMekLab - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # repository: ${{ steps.find_mml.outputs.mmlRepo }} # ref: ${{ steps.find_mml.outputs.mmlBranch }} @@ -122,7 +122,7 @@ jobs: # Setup the requested Java Distribution and Version from the matrix - name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ matrix.java-distribution }} java-version: ${{ matrix.java-version }} @@ -144,7 +144,7 @@ jobs: # Output Variables: # - buildScanUri - name: Build with Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: arguments: clean build --no-build-cache --info --continue --stacktrace --max-workers=1 --scan build-root-directory: mekhq @@ -181,14 +181,14 @@ jobs: # Put the Windows Release in an artifact # NB: Due to a GitHub Actions limitation we won't know what the filename is in order to display it somewhere. - name: Upload Windows Release - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: mhq-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }} path: ./mekhq/MekHQ/build/distributions/mekhq-windows-*.zip # Put the non-Windows release in an artifact - name: Upload Nix/Mac Release - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: mhq-release-nix-mac-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }} path: ./mekhq/MekHQ/build/distributions/*.tar diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index e264ee3834..f1adeea0ed 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -30,7 +30,7 @@ jobs: steps: # Checkout the Pull Request source and put it in: ./mekhq - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: mekhq @@ -43,14 +43,14 @@ jobs: # Checkout the latest MegaMek source and put it in: ./megamek - name: Checkout MegaMek - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: MegaMek/megamek path: megamek # Checkout the latest MegaMekLab source and put it in: ./megameklab - name: Checkout MegaMekLab - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: MegaMek/megameklab path: megameklab @@ -63,7 +63,7 @@ jobs: # Setup the requested Java Distribution and Version from the matrix - name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ matrix.java-distribution }} java-version: ${{ matrix.java-version }} @@ -85,7 +85,7 @@ jobs: # Output Variables: # - buildScanUri - name: Build with Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: arguments: clean build --no-build-cache --info --stacktrace --max-workers=1 --scan build-root-directory: mekhq @@ -94,7 +94,7 @@ jobs: # # The logs will be relative to the ./mekhq directory. - name: Upload Test Logs on Failure - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: cd-failure-logs diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cbfbc7983c..c2f08a0084 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,18 +35,18 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Setup the requested Java Distribution and Version from the matrix - name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ matrix.java-distribution }} java-version: ${{ matrix.java-version }} # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -58,7 +58,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild MekHQ - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -72,4 +72,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml index df05b09d61..505c75828c 100644 --- a/.github/workflows/nightly-ci.yml +++ b/.github/workflows/nightly-ci.yml @@ -30,7 +30,7 @@ jobs: steps: # Checkout the latest source and put it in: ./mekhq - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: mekhq @@ -43,14 +43,14 @@ jobs: # Checkout the latest MegaMek source and put it in: ./megamek - name: Checkout MegaMek - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: MegaMek/megamek path: megamek # Checkout the latest MegaMekLab source and put it in: ./megameklab - name: Checkout MegaMekLab - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: MegaMek/megameklab path: megameklab @@ -63,7 +63,7 @@ jobs: # Setup the requested Java Distribution and Version from the matrix - name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ matrix.java-distribution }} java-version: ${{ matrix.java-version }} @@ -76,13 +76,13 @@ jobs: # Include --stacktrace to make some build failures easier to figure out. - name: Build with Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: arguments: clean build -x test --continue --stacktrace --max-workers=1 --scan build-root-directory: mekhq - name: Upload Test Logs on Failure - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: ${{ matrix.os }}-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}-ci-failure-logs @@ -92,7 +92,7 @@ jobs: # # NB: Due to a GitHub Actions limitation we won't know what the filename is in order to display it somewhere. - name: Upload Nix/Mac Releases - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && matrix.os == 'ubuntu-latest' with: name: mhq-release-nix-mac-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }} @@ -102,7 +102,7 @@ jobs: # # NB: Due to a GitHub Actions limitation we won't know what the filename is in order to display it somewhere. - name: Upload Windows Release - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() && matrix.os == 'windows-latest' with: name: mhq-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }} diff --git a/.github/workflows/nightly-maven-ci.yml b/.github/workflows/nightly-maven-ci.yml index 4bf8a32ae6..7664b4badb 100644 --- a/.github/workflows/nightly-maven-ci.yml +++ b/.github/workflows/nightly-maven-ci.yml @@ -33,7 +33,7 @@ jobs: steps: # Checkout the latest source and put it in: ./mekhq - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: mekhq @@ -41,21 +41,21 @@ jobs: # Checkout the latest MegaMek source and put it in: ./megamek - name: Checkout MegaMek - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: MegaMek/megamek path: megamek # Checkout the latest MegaMekLab source and put it in: ./megameklab - name: Checkout MegaMekLab - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: MegaMek/megameklab path: megameklab # Setup the requested Java Distribution and Version from the matrix - name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ matrix.java-distribution }} java-version: ${{ matrix.java-version }} @@ -68,13 +68,13 @@ jobs: # Include --stacktrace to make some build failures easier to figure out. - name: Build with Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: arguments: clean build --continue --stacktrace --max-workers=1 --scan build-root-directory: mekhq - name: Upload Test Logs on Failure - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: ${{ matrix.os }}-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}-maven-ci-failure-logs diff --git a/MekHQ/data/names/callsigns.csv b/MekHQ/data/names/callsigns.csv index 8aa72f808a..4fc2580bb6 100644 --- a/MekHQ/data/names/callsigns.csv +++ b/MekHQ/data/names/callsigns.csv @@ -2259,7 +2259,6 @@ Weasel,1 Webcap,1 Wedge,1 Weevil,1 -Wendigo,1 Werewolf,1 Wharf,1 Wheel,1 diff --git a/MekHQ/docs/history.txt b/MekHQ/docs/history.txt index a8d57ecf64..498a908921 100644 --- a/MekHQ/docs/history.txt +++ b/MekHQ/docs/history.txt @@ -2,6 +2,7 @@ MEKHQ VERSION HISTORY: --------------- 0.49.19-SNAPSHOT + PR #3845: Adaptations for Adding Clan Personnel Tracking to MegaMek ++ Fix #3775: Non-superheavy Tripods can now be assigned crews; pilots can now be assigned to SH and Tripods in the personnel tab 0.49.18 (2024-02-17 1800 UTC) + PR #3805: Adaptations for the Internal Bomb Bay quirk diff --git a/MekHQ/src/mekhq/gui/menus/AssignPersonToUnitMenu.java b/MekHQ/src/mekhq/gui/menus/AssignPersonToUnitMenu.java index e682e827ff..0201d7e714 100644 --- a/MekHQ/src/mekhq/gui/menus/AssignPersonToUnitMenu.java +++ b/MekHQ/src/mekhq/gui/menus/AssignPersonToUnitMenu.java @@ -152,7 +152,8 @@ private void initialize(final Campaign campaign, final Person... people) { .sort(campaign.getHangar().getUnitsStream().filter(Unit::isAvailable)) .collect(Collectors.toList()); for (final Unit unit : units) { - if (unit.getEntity().getUnitType() != unitType) { + Entity entity = unit.getEntity(); + if (entity.getUnitType() != unitType) { // Add the current menus, first the Entity Weight Class menu to the related Unit // Type menu, then the Unit Type menu to the grouping menu pilotUnitTypeMenu.add(pilotEntityWeightMenu); @@ -173,12 +174,12 @@ private void initialize(final Campaign campaign, final Person... people) { navigatorMenu.add(navigatorUnitTypeMenu); // Update parsing variables - unitType = unit.getEntity().getUnitType(); - weightClass = unit.getEntity().getWeightClass(); + unitType = entity.getUnitType(); + weightClass = entity.getWeightClass(); // And create the new menus final String unitTypeName = UnitType.getTypeDisplayableName(unitType); - final String entityWeightClassName = EntityWeightClass.getClassName(weightClass, unit.getEntity()); + final String entityWeightClassName = EntityWeightClass.getClassName(weightClass, entity); pilotUnitTypeMenu = new JScrollableMenu("pilotUnitTypeMenu", unitTypeName); pilotEntityWeightMenu = new JScrollableMenu("pilotEntityWeightMenu", entityWeightClassName); driverUnitTypeMenu = new JScrollableMenu("driverUnitTypeMenu", unitTypeName); @@ -195,7 +196,7 @@ private void initialize(final Campaign campaign, final Person... people) { soldierEntityWeightMenu = new JScrollableMenu("soldierEntityWeightMenu", entityWeightClassName); navigatorUnitTypeMenu = new JScrollableMenu("navigatorUnitTypeMenu", unitTypeName); navigatorEntityWeightMenu = new JScrollableMenu("navigatorEntityWeightMenu", entityWeightClassName); - } else if (unit.getEntity().getWeightClass() != weightClass) { + } else if (entity.getWeightClass() != weightClass) { // Add the current Entity Weight Class menu to the Unit Type menu pilotUnitTypeMenu.add(pilotEntityWeightMenu); driverUnitTypeMenu.add(driverEntityWeightMenu); @@ -207,10 +208,10 @@ private void initialize(final Campaign campaign, final Person... people) { navigatorUnitTypeMenu.add(navigatorEntityWeightMenu); // Update parsing variable - weightClass = unit.getEntity().getWeightClass(); + weightClass = entity.getWeightClass(); // And create the new Entity Weight Class menus - final String entityWeightClassName = EntityWeightClass.getClassName(weightClass, unit.getEntity()); + final String entityWeightClassName = EntityWeightClass.getClassName(weightClass, entity); pilotEntityWeightMenu = new JScrollableMenu("pilotEntityWeightMenu", entityWeightClassName); driverEntityWeightMenu = new JScrollableMenu("driverEntityWeightMenu", entityWeightClassName); gunnerEntityWeightMenu = new JScrollableMenu("gunnerEntityWeightMenu", entityWeightClassName); @@ -224,17 +225,17 @@ private void initialize(final Campaign campaign, final Person... people) { // Pilot Menu if (unit.canTakeMoreDrivers()) { // Pilot Menu - Solo Pilot and VTOL Pilot Assignment - if (singlePerson && (unit.usesSoloPilot() || (unit.getEntity() instanceof VTOL))) { + if (singlePerson && (unit.usesSoloPilot() || (entity instanceof VTOL) || entity.isSuperHeavy() || entity.isTripodMek())) { final boolean valid; - if (unit.getEntity() instanceof Mech) { + if (entity instanceof Mech) { valid = areAllBattleMechPilots; - } else if (unit.getEntity() instanceof Protomech) { + } else if (entity instanceof Protomech) { valid = areAllProtoMechPilots; - } else if (unit.getEntity() instanceof ConvFighter) { + } else if (entity instanceof ConvFighter) { valid = areAllConventionalAerospacePilots; - } else if (unit.getEntity() instanceof Aero) { + } else if (entity instanceof Aero) { valid = areAllAerospacePilots; - } else if (unit.getEntity() instanceof VTOL) { + } else if (entity instanceof VTOL) { valid = areAllVTOLPilots; } else { valid = false; @@ -253,7 +254,7 @@ private void initialize(final Campaign campaign, final Person... people) { useTransfers = campaign.getCampaignOptions().isUseTransfers(); } - if (unit.getEntity() instanceof VTOL) { + if (entity instanceof VTOL) { unit.addDriver(people[0], useTransfers); } else { unit.addPilotOrSoldier(people[0], useTransfers); @@ -264,7 +265,7 @@ private void initialize(final Campaign campaign, final Person... people) { } // Pilot Menu - Small Craft and JumpShip Vessel Pilot Assignment - if (((unit.getEntity() instanceof SmallCraft) || (unit.getEntity() instanceof Jumpship)) + if (((entity instanceof SmallCraft) || (entity instanceof Jumpship)) && areAllVesselPilots) { final JMenuItem miVesselPilot = new JMenuItem(unit.getName()); miVesselPilot.setName("miVesselPilot"); @@ -289,9 +290,9 @@ private void initialize(final Campaign campaign, final Person... people) { } // Driver Menu - Non-VTOL Tank Driver Assignments - if (singlePerson && (unit.getEntity() instanceof Tank) - && !(unit.getEntity() instanceof VTOL)) { - if (unit.getEntity().getMovementMode().isMarine() + if (singlePerson && (entity instanceof Tank) + && !(entity instanceof VTOL)) { + if (entity.getMovementMode().isMarine() ? areAllNavalVehicleDrivers : areAllGroundVehicleDrivers) { final JMenuItem miDriver = new JMenuItem(unit.getName()); miDriver.setName("miDriver"); @@ -314,11 +315,13 @@ private void initialize(final Campaign campaign, final Person... people) { // Gunnery Menu if (unit.canTakeMoreGunners()) { final boolean valid; - if (unit.getEntity() instanceof Tank) { + if (entity instanceof Tank) { valid = areAllVehicleGunners; - } else if ((unit.getEntity() instanceof SmallCraft) - || (unit.getEntity() instanceof Jumpship)) { + } else if ((entity instanceof SmallCraft) + || (entity instanceof Jumpship)) { valid = areAllVesselGunners; + } else if (entity.isTripodMek() || entity.isSuperHeavy()) { + valid = areAllBattleMechPilots; } else { valid = false; } @@ -352,9 +355,9 @@ private void initialize(final Campaign campaign, final Person... people) { // TODO : also be based on crewmembers if (unit.canTakeMoreVesselCrew()) { final boolean valid; - if (unit.getEntity() instanceof Aero) { + if (entity instanceof Aero) { valid = areAllVesselCrew; - } else if (unit.getEntity().isSupportVehicle()) { + } else if (entity.isSupportVehicle()) { // TODO : Expand for Command and Control, Medical, Technician, and Salvage Assignments valid = areAllVehicleCrew; } else { @@ -393,8 +396,8 @@ private void initialize(final Campaign campaign, final Person... people) { if (singlePerson && unit.canTakeTechOfficer()) { // For a vehicle command console we will require the commander to be a driver // or a gunner, but not necessarily both - if (unit.getEntity() instanceof Tank) { - if (people[0].canDrive(unit.getEntity()) || people[0].canGun(unit.getEntity())) { + if (entity instanceof Tank) { + if (people[0].canDrive(entity) || people[0].canGun(entity)) { final JMenuItem miConsoleCommander = new JMenuItem(unit.getName()); miConsoleCommander.setName("miConsoleCommander"); miConsoleCommander.setForeground(unit.determineForegroundColor("Menu")); @@ -410,7 +413,7 @@ private void initialize(final Campaign campaign, final Person... people) { }); consoleCommanderEntityWeightMenu.add(miConsoleCommander); } - } else if (people[0].canDrive(unit.getEntity()) && people[0].canGun(unit.getEntity())) { + } else if (people[0].canDrive(entity) && people[0].canGun(entity)) { final JMenuItem miTechOfficer = new JMenuItem(unit.getName()); miTechOfficer.setName("miTechOfficer"); miTechOfficer.setForeground(unit.determineForegroundColor("Menu")); diff --git a/MekHQ/src/mekhq/gui/menus/AssignUnitToPersonMenu.java b/MekHQ/src/mekhq/gui/menus/AssignUnitToPersonMenu.java index 9069ced136..a40dbf837b 100644 --- a/MekHQ/src/mekhq/gui/menus/AssignUnitToPersonMenu.java +++ b/MekHQ/src/mekhq/gui/menus/AssignUnitToPersonMenu.java @@ -94,18 +94,20 @@ private void createPersonAssignmentMenus(final Campaign campaign, final Unit... final JScrollableMenu navigatorMenu = new JScrollableMenu("navigatorMenu", resources.getString("navigatorMenu.text")); // Parsing Booleans + final Entity entity = units[0].getEntity(); final boolean canTakeMoreDrivers = units[0].canTakeMoreDrivers(); final boolean usesSoloPilot = units[0].usesSoloPilot(); - final boolean isVTOL = units[0].getEntity() instanceof VTOL; - final boolean isMech = units[0].getEntity() instanceof Mech; - final boolean isSuperHeavyMech = isMech && units[0].getEntity().isSuperHeavy(); - final boolean isProtoMech = units[0].getEntity() instanceof Protomech; - final boolean isConventionalAircraft = units[0].getEntity() instanceof ConvFighter; - final boolean isSmallCraftOrJumpShip = (units[0].getEntity() instanceof SmallCraft) - || (units[0].getEntity() instanceof Jumpship); - final boolean isTank = units[0].getEntity() instanceof Tank; + final boolean isVTOL = entity instanceof VTOL; + final boolean isMech = entity instanceof Mech; + final boolean isTripod = entity instanceof TripodMech; + final boolean isSuperHeavyMech = isMech && entity.isSuperHeavy(); + final boolean isProtoMech = entity instanceof Protomech; + final boolean isConventionalAircraft = entity instanceof ConvFighter; + final boolean isSmallCraftOrJumpShip = (entity instanceof SmallCraft) + || (entity instanceof Jumpship); + final boolean isTank = entity instanceof Tank; final boolean canTakeMoreGunners = units[0].canTakeMoreGunners(); - final boolean isAero = units[0].getEntity() instanceof Aero; + final boolean isAero = entity instanceof Aero; final boolean canTakeTechOfficer = units[0].canTakeTechOfficer(); final boolean usesSoldiers = units[0].usesSoldiers(); final boolean isConventionalInfantry = units[0].isConventionalInfantry(); @@ -198,7 +200,7 @@ private void createPersonAssignmentMenus(final Campaign campaign, final Unit... // Pilot Menu if (canTakeMoreDrivers) { // Pilot Menu - if (usesSoloPilot || isVTOL || isSmallCraftOrJumpShip || isSuperHeavyMech) { + if (usesSoloPilot || isVTOL || isSmallCraftOrJumpShip || isSuperHeavyMech || isTripod) { if (isMech) { filteredPersonnel = personnel.stream() .filter(person -> person.getPrimaryRole().isMechWarriorGrouping() @@ -390,11 +392,11 @@ private void createPersonAssignmentMenus(final Campaign campaign, final Unit... } // Gunners Menu - if (canTakeMoreGunners && (isTank || isSmallCraftOrJumpShip || isSuperHeavyMech)) { + if (canTakeMoreGunners && (isTank || isSmallCraftOrJumpShip || isSuperHeavyMech || isTripod)) { filteredPersonnel = personnel.stream() .filter(person -> (isSmallCraftOrJumpShip && person.hasRole(PersonnelRole.VESSEL_GUNNER)) || (isTank && person.hasRole(PersonnelRole.VEHICLE_GUNNER)) || - (isSuperHeavyMech && person.getPrimaryRole().isMechWarriorGrouping() + ((isSuperHeavyMech || isTripod) && person.getPrimaryRole().isMechWarriorGrouping() || person.getSecondaryRole().isMechWarriorGrouping())) .collect(Collectors.toList()); if (!filteredPersonnel.isEmpty()) { @@ -410,17 +412,17 @@ private void createPersonAssignmentMenus(final Campaign campaign, final Unit... // Add the person to the proper menu for (final Person person : filteredPersonnel) { final JScrollableMenu subMenu; - + SkillLevel skillLevel = SkillLevel.NONE; - // determine skill level based on unit and person's role + // determine skill level based on unit and person's role if (isSmallCraftOrJumpShip) { skillLevel = person.getSkillLevel(campaign, !person.getPrimaryRole().isVesselGunner()); } else if (isTank) { skillLevel = person.getSkillLevel(campaign, !person.getPrimaryRole().isVehicleGunner()); - } else if (isSuperHeavyMech) { + } else if (isSuperHeavyMech || isTripod) { skillLevel = person.getSkillLevel(campaign, !person.getPrimaryRole().isMechWarriorGrouping()); } - + switch (skillLevel) { case LEGENDARY: subMenu = legendaryMenu; diff --git a/MekHQ/unittests/mekhq/campaign/parts/RefitTest.java b/MekHQ/unittests/mekhq/campaign/parts/RefitTest.java index 4e0340d7dc..5b0c3367a6 100644 --- a/MekHQ/unittests/mekhq/campaign/parts/RefitTest.java +++ b/MekHQ/unittests/mekhq/campaign/parts/RefitTest.java @@ -33,6 +33,7 @@ import mekhq.campaign.personnel.Person; import mekhq.campaign.unit.Unit; import mekhq.campaign.unit.UnitTestUtilities; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -77,6 +78,11 @@ public class RefitTest { @Mock private Warehouse mockWarehouse; + @BeforeAll + static void before() { + EquipmentType.initializeTypes(); + } + @BeforeEach public void beforeEach() { lenient().when(mockCampaign.getCampaignOptions()).thenReturn(mockCampaignOptions); @@ -157,7 +163,7 @@ public void locust1Vto1ETest() { // Locust 1V to 1E Class D refit steps (in no particular order): // 1. Remove excess Machine Gun (LA) [120 mins] // 2. Remove excess Machine Gun (RA) [120 mins] - // 3. Remove Machine Gun Ammo Bin (CT) [120 mins] + // 3. Remove Machine Gun Ammo [Full] Bin (CT) [120 mins] // 4. Move Medium Laser (CT) to (RA) [120 mins] // 5. Add Medium Laser to (LA) [120 mins] // 6. Add Small Laser to (RA) [120 mins] @@ -191,7 +197,7 @@ public void locust1Vto1ETest() { .filter(p -> (p instanceof EquipmentPart) && p.getName().equals("Machine Gun")) .count()); assertEquals(1, removedParts.stream() - .filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo Bin")) + .filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo [Full] Bin")) .count()); // All of the new parts should be from the old unit @@ -540,7 +546,7 @@ public void fleaFLE4toFLE15Test() { // 5. Add Medium Laser (RA) [120 mins] // 6. Add Machine Gun (LA) [120 mins] // 7. Add Machine Gun (RA) [120 mins] - // 8. Add Machine Gun Ammo Bin to (CT) [120 mins] + // 8. Add Machine Gun Ammo [Full] Bin to (CT) [120 mins] // 9. Add 16 points of armor to 10 locations (except the HD). // a. Add 1 point to (LA) [5 mins] // b. Add 1 point to (RA) [5 mins] @@ -601,7 +607,7 @@ public void fleaFLE4toFLE15Test() { .filter(p -> (p instanceof MissingEquipmentPart) && p.getName().equals("Machine Gun")) .count()); assertEquals(1, shoppingCart.stream() - .filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo Bin")) + .filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo [Full] Bin")) .count()); // We should have 16 points of standard armor on order @@ -767,7 +773,7 @@ public void heavyTrackedApcMgToStandard() throws EntityLoadingException, IOExcep .filter(p -> (p instanceof EquipmentPart) && p.getName().equals("Machine Gun")) .count()); assertEquals(1, removedParts.stream() - .filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo Bin")) + .filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo [Full] Bin")) .count()); // All of the new parts (except ammo bins) should be from the old unit