Skip to content

Commit

Permalink
handle SuperHeavyTank and LargeSupportTank together
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Jul 29, 2023
1 parent e51fc28 commit 677b285
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,8 @@ private static StringBuilder addArmorMiniVisToTT(Entity entity) {
default:
col3 = "";
}
} else if (entity instanceof Tank) {
} else if (entity instanceof SuperHeavyTank || entity instanceof LargeSupportTank) {
Tank tank = (Tank) entity;
boolean isSuperHeavyTank = entity instanceof SuperHeavyTank;
int tankTurrets = 0;

if (!tank.hasNoDualTurret()) {
Expand All @@ -512,26 +511,46 @@ private static StringBuilder addArmorMiniVisToTT(Entity entity) {
tankTurrets = 1;
}

String turretLocked = "";

switch (loc) {
case 0:
case 1:
case 2:
case 3:
case 4:
col3 = sysStabilizers(tank, loc, msg_abbr_stabilizers).toString();
break;
case 5:
case 6:
col3 = isSuperHeavyTank ? sysStabilizers(tank, loc, msg_abbr_stabilizers).toString() : "";
turretLocked = tankTurrets > 0 ? sysTurretLocked(tank, loc, msg_abbr_turretlocked).toString() : "";
col3 += isSuperHeavyTank ? "" : turretLocked;
col3 = sysStabilizers(tank, loc, msg_abbr_stabilizers).toString();
break;
case 7:
case 8:
turretLocked = tankTurrets > 0 ? sysTurretLocked(tank, loc, msg_abbr_turretlocked).toString() : "";
col3 = isSuperHeavyTank ? turretLocked : "";
col3 = sysStabilizers(tank, loc, msg_abbr_stabilizers).toString();
col3 += tankTurrets > 0 ? sysTurretLocked(tank, loc, msg_abbr_turretlocked).toString() : "";
break;
default:
col3 = "";
}
} else if (entity instanceof Tank) {
Tank tank = (Tank) entity;
int tankTurrets = 0;

if (!tank.hasNoDualTurret()) {
tankTurrets = 2;
} else if (!tank.hasNoTurret()) {
tankTurrets = 1;
}

switch (loc) {
case 0:
case 1:
case 2:
case 3:
case 4:
col3 = sysStabilizers(tank, loc, msg_abbr_stabilizers).toString();
break;
case 5:
case 6:
col3 = sysStabilizers(tank, loc, msg_abbr_stabilizers).toString();
col3 += tankTurrets > 0 ? sysTurretLocked(tank, loc, msg_abbr_turretlocked).toString() : "";
break;
default:
col3 = "";
Expand All @@ -558,7 +577,7 @@ private static StringBuilder addArmorMiniVisToTT(Entity entity) {
rows += row;
} else if (entity instanceof Tank) {
Tank tank = (Tank) entity;
Boolean isVTOL = entity instanceof VTOL;
boolean isVTOL = entity instanceof VTOL;

col1 = "";
col2 = sysEngineHit(tank, msg_abbr_engine).toString();
Expand Down

0 comments on commit 677b285

Please sign in to comment.