From 11e88e9d380859f81631894596ddc28760608e43 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Thu, 28 Nov 2024 09:39:47 -0500 Subject: [PATCH] add flee failed to report log --- .../i18n/megamek/common/report-messages.properties | 1 + .../megamek/client/ui/swing/MovementDisplay.java | 14 +++++++------- .../server/totalwarfare/MovePathHandler.java | 10 ++++++++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/megamek/i18n/megamek/common/report-messages.properties b/megamek/i18n/megamek/common/report-messages.properties index b82e7e2a3aa..5359217602f 100755 --- a/megamek/i18n/megamek/common/report-messages.properties +++ b/megamek/i18n/megamek/common/report-messages.properties @@ -80,6 +80,7 @@ 2010=It carries () with it. 2015=It takes () with it. 2016=It carries with it. +2017= flee failed. 2020= ejects from a (). 2025= () is abandoned by its crew. 2026= () is given the order to abandon ship. diff --git a/megamek/src/megamek/client/ui/swing/MovementDisplay.java b/megamek/src/megamek/client/ui/swing/MovementDisplay.java index 08910dec2fc..f32db7ccbf3 100644 --- a/megamek/src/megamek/client/ui/swing/MovementDisplay.java +++ b/megamek/src/megamek/client/ui/swing/MovementDisplay.java @@ -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. @@ -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() { diff --git a/megamek/src/megamek/server/totalwarfare/MovePathHandler.java b/megamek/src/megamek/server/totalwarfare/MovePathHandler.java index cad5a1d8c93..bb0aaa246e8 100644 --- a/megamek/src/megamek/server/totalwarfare/MovePathHandler.java +++ b/megamek/src/megamek/server/totalwarfare/MovePathHandler.java @@ -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); + } } }