From 1eff9f6aaa67e787792f802df5c898fa7e4dca87 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:13:09 +0200 Subject: [PATCH] Fix bloodcat ambush endless loop (#343) Some bloodcats during ambushes could have ubInsertionDirection with values > 100, which then causes endless looping in pathfinding algorithms as valid direction values range from 0 to 7 --- Tactical/Soldier Add.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index 654283be..67b0e79d 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1201,7 +1201,14 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO if( fCalculateDirection ) ubDirection = ubCalculatedDirection; else + { + // Override calculated direction if we were told to.... + if ( pSoldier->ubInsertionDirection >= 100 ) + { + pSoldier->ubInsertionDirection -= 100; + } ubDirection = pSoldier->ubInsertionDirection; + } } else {