From 6b727515380cdf2b3321c13c19b99e435f2e5157 Mon Sep 17 00:00:00 2001 From: Wanne Date: Tue, 31 May 2011 19:03:21 +0000 Subject: [PATCH] - Bugfix: Fixed CTD that could occur on enemy soldier pathing git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4466 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/PATHAI.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 45dad61e..85be9c65 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -4352,6 +4352,13 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl // We should reduce points for starting to run if first tile is a fence... sTestGridNo = NewGridNo(pSold->sGridNo, DirectionInc( (UINT8)guiPathingData[0])); + + // WANNE: Quickfix for wrong pathing data (direction). This fixes crash that could rarly occur + if ((UINT8)guiPathingData[0] > 7) + { + guiPathingData[0] = 0; + } + if ( gubWorldMovementCosts[ sTestGridNo ][ guiPathingData[0] ][ pSold->pathing.bLevel] == TRAVELCOST_FENCE ) { if ( usMovementMode == RUNNING && pSold->usAnimState != RUNNING )