From c5700b8b0337c08908459ad8ae6324a7e806fe09 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 29 Jun 2023 23:14:34 +0200 Subject: [PATCH] MechView: correct bad   and
texts in text mode --- megamek/src/megamek/common/MechView.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/megamek/src/megamek/common/MechView.java b/megamek/src/megamek/common/MechView.java index 509b4e0fb1a..eeffb120f92 100644 --- a/megamek/src/megamek/common/MechView.java +++ b/megamek/src/megamek/common/MechView.java @@ -216,7 +216,7 @@ public MechView(final Entity entity, final boolean showDetail, final boolean use } TableElement tpTable = new TableElement(3); - String tableSpacer = "     "; + String tableSpacer = " "; tpTable.setColNames(Messages.getString("MechView.Level"), tableSpacer, Messages.getString("MechView.Era")); tpTable.setJustification(TableElement.JUSTIFIED_LEFT, TableElement.JUSTIFIED_LEFT,TableElement.JUSTIFIED_LEFT); @@ -471,7 +471,7 @@ public MechView(final Entity entity, final boolean showDetail, final boolean use Game game = entity.getGame(); if ((game == null) || game.getOptions().booleanOption(OptionsConstants.ADVANCED_STRATOPS_QUIRKS)) { - StringJoiner quirksList = new StringJoiner("
\n"); + List quirksList = new ArrayList<>(); Quirks quirks = entity.getQuirks(); for (Enumeration optionGroups = quirks.getGroups(); optionGroups.hasMoreElements();) { @@ -487,14 +487,14 @@ public MechView(final Entity entity, final boolean showDetail, final boolean use } } } - if (quirksList.length() > 0) { + if (!quirksList.isEmpty()) { + sFluff.add(new SingleLine()); ItemList list = new ItemList(Messages.getString("MechView.Quirks")); - list.addItem(quirksList.toString()); + quirksList.forEach(list::addItem); sFluff.add(list); } - String wpQuirksList = ""; - + List wpQuirksList = new ArrayList<>(); for (Mounted weapon: entity.getWeaponList()) { for (Enumeration optionGroups = weapon.getQuirks().getGroups(); optionGroups.hasMoreElements();) { IOptionGroup group = optionGroups.nextElement(); @@ -512,15 +512,16 @@ public MechView(final Entity entity, final boolean showDetail, final boolean use if (!wq.isEmpty()) { wq = weapon.getDesc() + ": " + wq.substring(0, wq.length() - 2); - wpQuirksList += wq + "
"; + wpQuirksList.add(wq); } } } } if (!wpQuirksList.isEmpty()) { - ItemList list = new ItemList("
" + Messages.getString("MechView.WeaponQuirks")); - list.addItem(wpQuirksList); + sFluff.add(new SingleLine()); + ItemList list = new ItemList(Messages.getString("MechView.WeaponQuirks")); + wpQuirksList.forEach(list::addItem); sFluff.add(list); } }