Skip to content

Commit a847cba

Browse files
authored
Merge pull request #2151 from SJuliez/mml-2052-2036
Issue MML2052 remove extra ")"
2 parents 98b54dc + bb725b7 commit a847cba

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

megameklab/src/megameklab/printing/InventoryWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ public InventoryWriter(PrintEntity sheet) {
274274
}
275275
fuelText = sheet.formatTacticalFuel();
276276
str = sheet.formatFeatures();
277-
featuresText = str.isEmpty() ? str : "Features " + str;
277+
featuresText = str.isEmpty() ? "" : "Features " + str;
278278
miscNotesText = sheet.formatMiscNotes();
279279
str = sheet.formatQuirks();
280-
quirksText = str.isEmpty() ? str : "Quirks: " + str;
280+
quirksText = str.isEmpty() ? "" : "Quirks: " + str;
281281
}
282282

283283
public InventoryWriter(PrintEntity sheet, SVGRectElement svgRect) {

megameklab/src/megameklab/printing/PrintEntity.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import megamek.common.units.ProtoMek;
8080
import megamek.common.units.UnitRole;
8181
import megamek.common.units.UnitType;
82+
import megamek.common.verifier.TestEntity;
8283
import megameklab.util.CConfig;
8384
import megameklab.util.RSScale;
8485
import megameklab.util.UnitUtil;
@@ -233,20 +234,17 @@ public String formatTacticalFuel() {
233234

234235
/**
235236
* Converts a weight to a String, either in kg or tons as appropriate to the Entity, labeled with the measurement
236-
* unit.
237+
* unit (e.g. "1 ton", "3 tons", "2750 kg").
237238
*
238239
* @param weight The weight in tons
239240
*
240241
* @return The formatted weight with units
241242
*/
242243
String formatWeight(double weight) {
243-
if ((getEntity() instanceof BattleArmor)
244-
|| (getEntity() instanceof ProtoMek)
245-
|| getEntity().getWeightClass() == EntityWeightClass.WEIGHT_SMALL_SUPPORT) {
244+
if (TestEntity.usesKgStandard(getEntity())) {
246245
return DecimalFormat.getInstance().format(weight * 1000) + " kg";
247246
} else {
248-
return DecimalFormat.getInstance().format(weight)
249-
+ ((weight == 1) ? " ton)" : " tons");
247+
return DecimalFormat.getInstance().format(weight) + ((weight == 1) ? " ton" : " tons");
250248
}
251249
}
252250

0 commit comments

Comments
 (0)