From b0d4910a3c7a4820bd009bf6d99f98daa7d92089 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 2 Aug 2026 19:09:07 -0300 Subject: [PATCH] Add prev-mode overload of EstimateActionPointCost Forwards to the new ActionPointCost prev-mode overload so a path estimator can pass its simulated prior tile mode. Existing 6-arg callers use the soldier's live anim state and are unchanged. Co-Authored-By: Claude Opus 4.8 --- Tactical/Points.cpp | 7 ++++++- Tactical/Points.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index b6a8c1153..8f0fc79b5 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -653,6 +653,11 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 u } INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 usMovementMode, INT8 bPathIndex, INT8 bPathLength ) +{ + return EstimateActionPointCost( pSoldier, sGridNo, bDir, usMovementMode, bPathIndex, bPathLength, pSoldier->usAnimState ); +} + +INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 usMovementMode, INT8 bPathIndex, INT8 bPathLength, UINT16 usPrevMovementMode ) { // This action point cost code includes the penalty for having to change // stance after jumping a fence IF our path continues... @@ -723,7 +728,7 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, } } - sPoints += ActionPointCost( pSoldier, sGridNo, bDir, usMovementMode ); + sPoints += ActionPointCost( pSoldier, sGridNo, bDir, usMovementMode, usPrevMovementMode ); return (sPoints); } diff --git a/Tactical/Points.h b/Tactical/Points.h index ce3833522..ad2fda698 100644 --- a/Tactical/Points.h +++ b/Tactical/Points.h @@ -290,6 +290,10 @@ INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT32 sGridno, INT8 bDir, INT8 INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 usMovementMode, UINT16 usPrevMovementMode ); // Convenience overload: prev mode = the soldier's current anim state (correct for real, per-step movement). INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 usMovementMode ); +// bPathIndex/bPathLength give the fence-continuation context; usPrevMovementMode is the +// previous tile's mode (see ActionPointCost). Estimators summing a path pass their simulated +// prior mode; the shorter overload uses the soldier's live anim state. +INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 usMovementMode, INT8 bPathIndex, INT8 bPathLength, UINT16 usPrevMovementMode ); INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 usMovementMode, INT8 bPathIndex, INT8 bPathLength ); BOOLEAN SelectedMercCanAffordMove( );