Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MechView: correct bad &nbsp; and <BR> texts in text mode #4573

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions megamek/src/megamek/common/MechView.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public MechView(final Entity entity, final boolean showDetail, final boolean use
}

TableElement tpTable = new TableElement(3);
String tableSpacer = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
String tableSpacer = " ";
tpTable.setColNames(Messages.getString("MechView.Level"), tableSpacer,
Messages.getString("MechView.Era"));
tpTable.setJustification(TableElement.JUSTIFIED_LEFT, TableElement.JUSTIFIED_LEFT,TableElement.JUSTIFIED_LEFT);
Expand Down Expand Up @@ -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("<br/>\n");
List<String> quirksList = new ArrayList<>();
Quirks quirks = entity.getQuirks();

for (Enumeration<IOptionGroup> optionGroups = quirks.getGroups(); optionGroups.hasMoreElements();) {
Expand All @@ -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<String> wpQuirksList = new ArrayList<>();
for (Mounted weapon: entity.getWeaponList()) {
for (Enumeration<IOptionGroup> optionGroups = weapon.getQuirks().getGroups(); optionGroups.hasMoreElements();) {
IOptionGroup group = optionGroups.nextElement();
Expand All @@ -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 + "<BR/>";
wpQuirksList.add(wq);
}
}
}
}

if (!wpQuirksList.isEmpty()) {
ItemList list = new ItemList("<BR/>" + 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);
}
}
Expand Down