Skip to content

Commit

Permalink
add flee failed to report log
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Nov 28, 2024
1 parent 492ec63 commit 11e88e9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions megamek/i18n/megamek/common/report-messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
2010=It carries <data> (<data>) with it.
2015=It takes <data> (<data>) with it.
2016=It carries <data> with it.
2017=<newline> flee failed.
2020=<newline><data> ejects from a <data> (<data>).
2025=<newline><data> (<data>) is abandoned by its crew.
2026=<newline><data> (<data>) is given the order to abandon ship.
Expand Down
14 changes: 7 additions & 7 deletions megamek/src/megamek/client/ui/swing/MovementDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -853,12 +853,8 @@ private void updateButtons() {
(ce instanceof Tank)
&& (ce.getSwarmAttackerId() != Entity.NONE));

boolean fleeStart = (cmd.getLastStep() == null)
&& ce().canFlee(ce().getPosition());
boolean fleeEnd = (cmd.getLastStep() != null)
&& (cmd.getLastStepMovementType() != EntityMovementType.MOVE_ILLEGAL)
&& clientgui.getClient().getGame().canFleeFrom(ce(), cmd.getLastStep().getPosition());
setFleeEnabled(fleeStart || fleeEnd);
updateFleeButton();

if (gOpts.booleanOption(OptionsConstants.ADVGRNDMOV_VEHICLES_CAN_EJECT) && (ce instanceof Tank)) {
// Vehicle don't have ejection systems so crews abandon, and must enter a valid
// hex.
Expand Down Expand Up @@ -974,13 +970,17 @@ private void updateMove(boolean redrawMovement) {
clientgui.getBoardView().drawMovementData(ce(), cmd);
}

updateFleeButton();
updateDonePanel();
}

private void updateFleeButton() {
boolean fleeStart = (cmd.getLastStep() == null)
&& ce().canFlee(ce().getPosition());
boolean fleeEnd = (cmd.getLastStep() != null)
&& (cmd.getLastStepMovementType() != EntityMovementType.MOVE_ILLEGAL)
&& clientgui.getClient().getGame().canFleeFrom(ce(), cmd.getLastStep().getPosition());
setFleeEnabled(fleeStart || fleeEnd);
updateDonePanel();
}

private void updateAeroButtons() {
Expand Down
10 changes: 8 additions & 2 deletions megamek/src/megamek/server/totalwarfare/MovePathHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1196,8 +1196,14 @@ && getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_FUEL_CONSU
}

// check for fleeing
if (md.contains(MovePath.MoveStepType.FLEE) && entity.canFlee(entity.getPosition())) {
addReport(gameManager.processLeaveMap(md, false, -1));
if (md.contains(MovePath.MoveStepType.FLEE)) {
if (entity.canFlee(entity.getPosition())) {
addReport(gameManager.processLeaveMap(md, false, -1));
} else {
r = new Report(2017, Report.PUBLIC);
r.indent();
addReport(r);
}
}
}

Expand Down

0 comments on commit 11e88e9

Please sign in to comment.