Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Oct 25, 2024
1 parent e89bb06 commit 436ae38
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,6 @@ private static StringBuilder weaponList(Entity entity) {
HashMap<String, WeaponInfo> wpInfos = createWeaponList(entity);

// Print to Tooltip
String row = "";
String rows = "";

// Display sorted by weapon name
Expand All @@ -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);
Expand All @@ -923,8 +920,10 @@ private static StringBuilder weaponList(Entity entity) {
return new StringBuilder().append(table);
}

/**
* Gather names, counts, Clan/IS
*/
public static HashMap<String, WeaponInfo> createWeaponList(Entity entity) {
// Gather names, counts, Clan/IS
HashMap<String, WeaponInfo> wpInfos = new HashMap<>();
WeaponInfo currentWp;
List<WeaponMounted> weapons = entity.getWeaponList();
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 436ae38

Please sign in to comment.