From 436ae3875db03a13d428b7966b3a68e6ca7e6422 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Fri, 25 Oct 2024 18:04:05 -0400 Subject: [PATCH] code cleanup --- .../client/ui/swing/tooltip/UnitToolTip.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java b/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java index 9d226488dbe..d23be02e5b7 100644 --- a/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java +++ b/megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java @@ -899,7 +899,6 @@ private static StringBuilder weaponList(Entity entity) { HashMap wpInfos = createWeaponList(entity); // Print to Tooltip - String row = ""; String rows = ""; // Display sorted by weapon name @@ -909,12 +908,10 @@ private static StringBuilder weaponList(Entity entity) { for (WeaponInfo currentEquip : wps) { // This WeaponInfo is ammo if (!currentEquip.ammos.isEmpty()) { - row = createAmmoEntry(currentEquip).toString(); + rows += createAmmoEntry(currentEquip).toString(); } else { - row = createWeaponEntry(entity, currentEquip).toString(); + rows += createWeaponEntry(entity, currentEquip).toString(); } - - rows += row; } String tbody = UIUtil.tag("TBODY", "", rows); @@ -923,8 +920,10 @@ private static StringBuilder weaponList(Entity entity) { return new StringBuilder().append(table); } + /** + * Gather names, counts, Clan/IS + */ public static HashMap createWeaponList(Entity entity) { - // Gather names, counts, Clan/IS HashMap wpInfos = new HashMap<>(); WeaponInfo currentWp; List weapons = entity.getWeaponList(); @@ -1141,7 +1140,7 @@ private static String weaponModifier(boolean isDestroyed, WeaponInfo currentEqui } /** Returns the weapon line(s) for the weapons type. - * Check if weapon is destroyed, text gray and strikethrough if so, remove the "x "/"*" + * Check if weapon is destroyed, text gray and strikethrough if so, remove the "x "/"*" **/ private static StringBuilder createWeaponEntry(Entity entity, WeaponInfo currentEquip) { String fontSizeAttr = String.format("class=%s", GUIP.getUnitToolTipFontSizeMod()); @@ -1206,7 +1205,6 @@ private static StringBuilder createWeaponEntry(Entity entity, WeaponInfo current col2 = UIUtil.tag("FONT", attr, col2); col2 = UIUtil.tag("span", fontSizeAttr, col2); col2 = UIUtil.tag("TD", "", col2); - ; row = UIUtil.tag("TR", "", col1 + col2); return new StringBuilder().append(row);