From af6286c8c0e20ca2879bd2defbc3587818b81799 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 21 Dec 2023 17:03:16 +0100 Subject: [PATCH] Weight calc correction, some utility --- megamek/src/megamek/common/Entity.java | 5 +++++ megamek/src/megamek/common/verifier/TestEntity.java | 8 ++++++++ .../src/megamek/common/verifier/TestSupportVehicle.java | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/megamek/src/megamek/common/Entity.java b/megamek/src/megamek/common/Entity.java index 3100fa83bdd..4eaeb5a6de9 100644 --- a/megamek/src/megamek/common/Entity.java +++ b/megamek/src/megamek/common/Entity.java @@ -11073,6 +11073,11 @@ public Engine getEngine() { return engine; } + /** @return The type of engine if it has an engine, or Engine.NONE, if it has no engine. */ + public int getEngineType() { + return hasEngine() ? getEngine().getEngineType() : Engine.NONE; + } + public boolean hasEngine() { return (null != engine); } diff --git a/megamek/src/megamek/common/verifier/TestEntity.java b/megamek/src/megamek/common/verifier/TestEntity.java index 7671c16f5ed..a74aba999e3 100755 --- a/megamek/src/megamek/common/verifier/TestEntity.java +++ b/megamek/src/megamek/common/verifier/TestEntity.java @@ -1689,6 +1689,14 @@ boolean usesKgStandard() { return usesKgStandard(getEntity()); } + + public int totalCritSlotCount() { + int slotCount = 0; + for (int i = 0; i < getEntity().locations(); i++) { + slotCount += getEntity().getNumberOfCriticals(i); + } + return slotCount; + } } // End class TestEntity class Armor { diff --git a/megamek/src/megamek/common/verifier/TestSupportVehicle.java b/megamek/src/megamek/common/verifier/TestSupportVehicle.java index 56d51ec576c..909cb351593 100644 --- a/megamek/src/megamek/common/verifier/TestSupportVehicle.java +++ b/megamek/src/megamek/common/verifier/TestSupportVehicle.java @@ -720,7 +720,7 @@ public double calculateWeight() { @Override public double calculateWeightExact() { - return super.calculateWeight() + getFuelTonnage(); + return super.calculateWeightExact() + getFuelTonnage(); } @Override