Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Nov 11, 2023
1 parent d2caa6e commit 85cc221
Show file tree
Hide file tree
Showing 40 changed files with 178 additions and 174 deletions.
2 changes: 1 addition & 1 deletion megamek/src/megamek/client/ui/swing/MovementDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -4215,7 +4215,7 @@ private void dumpBombs() {
r.subject = ce().getId();
r.add(ce().getDisplayName());
r.add(psr);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
r.newlines = 0;
r.indent(1);
if (rollValue < psr.getValue()) {
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/Building.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public boolean rollBasement(Coords coords, Board board, Vector<Report> vPhaseRep
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
if (rollValue == 2) {
basement.put(coords, BasementType.TWO_DEEP_FEET);
hex.addTerrain(new Terrain(Terrains.BLDG_BASEMENT_TYPE, basement.get(coords).ordinal()));
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13444,7 +13444,7 @@ private boolean doMASCOrSuperchargerFailureCheckFor(Mounted masc, Vector<Report>
r.subject = getId();
r.indent();
r.add(isSupercharger ? getSuperchargerTarget() : getMASCTarget());
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);

if ((!isSupercharger && (rollValue < getMASCTarget()))
|| (isSupercharger && (rollValue < getSuperchargerTarget()))) {
Expand All @@ -13461,7 +13461,7 @@ private boolean doMASCOrSuperchargerFailureCheckFor(Mounted masc, Vector<Report>
String rollReport2 = diceRoll2.getReport();
r = new Report(6310);
r.subject = getId();
r.addDataWithTooltip(String.valueOf(rollValue2), rollReport2);
r.addDataWithTooltip(rollValue2, rollReport2);
r.newlines = 0;
vDesc.addElement(r);
if (rollValue2 <= 7) {
Expand Down
6 changes: 3 additions & 3 deletions megamek/src/megamek/common/Mech.java
Original file line number Diff line number Diff line change
Expand Up @@ -5465,7 +5465,7 @@ public Vector<Report> doCheckEngineStallRoll(Vector<Report> vPhaseReport) {
Roll diceRoll = getCrew().rollPilotingSkill();
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
Report r = Report.subjectReport(2300, getId()).add(psr).addDataWithTooltip(String.valueOf(rollValue), rollReport);
Report r = Report.subjectReport(2300, getId()).add(psr).addDataWithTooltip(rollValue, rollReport);
if (rollValue < psr.getValue()) {
setStalled(true);
vPhaseReport.add(r.noNL().choose(false));
Expand Down Expand Up @@ -5497,7 +5497,7 @@ public void checkUnstall(Vector<Report> vPhaseReport) {
Roll diceRoll = getCrew().rollPilotingSkill();
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
Report r = Report.subjectReport(2300, getId()).add(psr).addDataWithTooltip(String.valueOf(rollValue), rollReport);
Report r = Report.subjectReport(2300, getId()).add(psr).addDataWithTooltip(rollValue, rollReport);
if (rollValue < psr.getValue()) {
vPhaseReport.add(r.choose(false));
} else {
Expand Down Expand Up @@ -6258,7 +6258,7 @@ public boolean doRISCEmergencyCoolantCheckFor(Vector<Report> vDesc,
bUsedCoolantSystem = true;
vDesc.addElement(Report.subjectReport(2365, getId()).addDesc(this).add(coolantSystem.getName()));
int requiredRoll = EMERGENCY_COOLANT_SYSTEM_FAILURE[nCoolantSystemLevel];
Report r = Report.subjectReport(2370, getId()).indent().add(requiredRoll).addDataWithTooltip(String.valueOf(rollValue), rollReport);
Report r = Report.subjectReport(2370, getId()).indent().add(requiredRoll).addDataWithTooltip(rollValue, rollReport);

if (rollValue < requiredRoll) {
// uh oh
Expand Down
4 changes: 4 additions & 0 deletions megamek/src/megamek/common/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ public Report add(TargetRoll targetRoll) {
return this;
}

public Report addDataWithTooltip(Integer data, String tooltip) {
return addDataWithTooltip(String.valueOf(data), tooltip);
}

/**
* Adds a field to the report with additional data available as a tooltip
*
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/ACCaselessHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected boolean doChecks(Vector<Report> vPhaseReport) {

Report r = new Report(3164);
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);

if (rollValue >= 8) {
// Round explodes destroying weapon
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/AR10Handler.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/AmmoWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected boolean doAmmoFeedProblemCheck(Vector<Report> vPhaseReport) {
Report r = new Report(3173);
r.subject = subjectId;
r.newlines = 0;
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
vPhaseReport.addElement(r);

if (rollValue == 12) {
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/AreaEffectHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public static void checkInfantryDestruction(Entity entity, int distFromCenter, E
r.subject = attacker.getId();
r.newlines = 1;
r.add(rollTarget);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
r.add(distFromCenter);
r.choose(destroyed);
vPhaseReport.addElement(r);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public boolean accept(Entity entity) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down Expand Up @@ -505,15 +505,15 @@ protected int handleAMS(Vector<Report> vPhaseReport, Mounted ammoUsed) {
r = new Report(3240);
r.subject = subjectId;
r.add("missile");
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
vPhaseReport.add(r);
nDamPerHit = 0;
hits = 0;

} else {
r = new Report(3241);
r.add("missile");
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
r.subject = subjectId;
vPhaseReport.add(r);
hits = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ else if ((null != bestSpotter) && !(this instanceof ArtilleryWeaponDirectFireHan
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/weapons/BayWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down Expand Up @@ -436,7 +436,7 @@ public boolean handleAeroSanity(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/BombAttackHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/weapons/CLIATMHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down Expand Up @@ -643,7 +643,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down Expand Up @@ -641,7 +641,7 @@ public boolean handleAeroSanity(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ && getParentBayHandler() != null) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected void handleEntityDamage(Entity entityTarget, Vector<Report> vPhaseRepo
r.indent(3);
r.addDesc(entityTarget);
r.add(shutdown);
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
if (rollValue >= shutdown) {
// avoided
r.choose(true);
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/weapons/FluidGunCoolHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void handleEntityDamage(Entity entityTarget, Vector<Report> vPhaseRepo
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
if (rollValue == 12) {
r.choose(true);
entityTarget.infernos.clear();
Expand All @@ -77,7 +77,7 @@ protected void handleEntityDamage(Entity entityTarget, Vector<Report> vPhaseRepo
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
if (rollValue >= 4) {
r.choose(true);
for (int i = 0; i < entityTarget.locations(); i++) {
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/LRMSwarmHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/weapons/MechTaserHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected boolean specialResolution(Vector<Report> vPhaseReport, Entity entityTa
Roll diceRoll = Compute.rollD6(2);
int rollValue = diceRoll.getIntValue();
String rollReport = diceRoll.getReport();
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
r.newlines = 0;
vPhaseReport.add(r);
if (entityTarget.getWeight() > 100) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/weapons/MissileWeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
r = new Report(3155);
r.newlines = 0;
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(roll), rollReport);
r.addDataWithTooltip(roll, rollReport);
vPhaseReport.addElement(r);

// do we hit?
Expand Down Expand Up @@ -848,7 +848,7 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
String rollReport = diceRoll.getReport();
r = new Report(3352);
r.subject = subjectId;
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
vPhaseReport.add(r);
hits = Math.max(0, hits - rollValue);
}
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/weapons/NarcExplosiveHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ protected int calcHits(Vector<Report> vPhaseReport) {
r = new Report(3240);
r.subject = subjectId;
r.add("pod");
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
vPhaseReport.add(r);
return 0;
}
r = new Report(3241);
r.add("pod");
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
r.subject = subjectId;
vPhaseReport.add(r);
}
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/weapons/NarcHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ protected int calcHits(Vector<Report> vPhaseReport) {
r = new Report(3240);
r.subject = subjectId;
r.add("pod");
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
vPhaseReport.add(r);
return 0;
}
r = new Report(3241);
r.add("pod");
r.addDataWithTooltip(String.valueOf(rollValue), rollReport);
r.addDataWithTooltip(rollValue, rollReport);
r.subject = subjectId;
vPhaseReport.add(r);
}
Expand Down
Loading

0 comments on commit 85cc221

Please sign in to comment.