From c57b94c16850514eb1658526be0ac77236abadbe Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:54:01 +0200 Subject: [PATCH 1/2] Fix passive bloodcats --- TacticalAI/Movement.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index ec5daaaf2f..5bc4b0a9ea 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -516,13 +516,18 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN #ifdef DEBUGDECISIONS AIPopMessage("destination Grid # itself not valid, looking around it"); #endif - if ( CREATURE_OR_BLOODCAT( pSoldier ) ) - { - // we tried to get close, failed; abort! - pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; - return( NOWHERE ); - } - else + // Commented out this branch for now because bloodcats are constantly failing to find a legal destination in the previous call to legalNPCDestination + // Following the function calls deep enough ( GoAsFarAsPossibleTowards -> InternalGoAsFarAsPossibleTowards -> LegalNPCDestination -> NewOKDestination -> InternalOkayToAddStructureToWorld -> OkayToAddStructureToTile) shows that the last one fails when checking if we can add bloodcat's structure onto the tile our merc is + // This then results them freezing and staying in place even if they can see our mercs + // The reason I'm leaving the code here instead of simply removing it is because this and the check for adding structures to a tile are really old code, + // which has definitely worked fine at some point. As I'm right now unable to find the real reason for this breaking, I'm just circumventing the issue for now. -Asdow + //if ( CREATURE_OR_BLOODCAT( pSoldier ) ) + //{ + // // we tried to get close, failed; abort! + // pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; + // return( NOWHERE ); + //} + //else { // else look at the 8 nearest gridnos to sDesGrid for a valid destination From 06eb58bdf2e41edf4a27534bbbce48f6a25011fd Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:55:56 +0200 Subject: [PATCH 2/2] Allow bloodcats in RED state to roam farther Bloodcat lair had a few cats with CLOSE PATROL orders, resulting them to move only 15 tiles from their starting point, allowing them to be picked off from afar with scoped rifles. --- TacticalAI/AIUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index b6b5bf4345..e0f53ecc42 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -2787,7 +2787,7 @@ INT16 RoamingRange(SOLDIERTYPE *pSoldier, INT32 * pusFromGridNo) BOOL OppPosKnown = FALSE; if (CREATURE_OR_BLOODCAT(pSoldier)) { - if (pSoldier->aiData.bAlertStatus == STATUS_BLACK) + if (pSoldier->aiData.bAlertStatus > STATUS_YELLOW) { *pusFromGridNo = pSoldier->sGridNo; // from current position! return(MAX_ROAMING_RANGE);