From 16f1ddb61c1cd30da09d00dec6536a86f405be48 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 19 Nov 2025 03:27:05 +1100 Subject: [PATCH] bugfix: Undetected mines can now be approached when using a disarm weapon --- Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 ++++++++ .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 79913a7c7d..4e4a849894 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -2596,7 +2596,15 @@ StateReturnType AIAttackApproachTargetState::updateInternal() { if( victim->testStatus( OBJECT_STATUS_STEALTHED ) && !victim->testStatus( OBJECT_STATUS_DETECTED ) ) { +#if RETAIL_COMPATIBLE_CRC return STATE_FAILURE; // If obj is stealthed, can no longer approach. +#else + Bool isTargetingMine = weapon && weapon->getDamageType() == DAMAGE_DISARM && + (victim->isKindOf(KINDOF_MINE)); + + if (!isTargetingMine) + return STATE_FAILURE; // If obj is stealthed, can no longer approach - unless we're targeting a mine! +#endif } ai->setCurrentVictim(victim); // Attacking an object. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 6988747599..487c1068f3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -2682,7 +2682,15 @@ StateReturnType AIAttackApproachTargetState::updateInternal() } if( victim->testStatus( OBJECT_STATUS_STEALTHED ) && !victim->testStatus( OBJECT_STATUS_DETECTED ) && !victim->testStatus( OBJECT_STATUS_DISGUISED ) ) { +#if RETAIL_COMPATIBLE_CRC return STATE_FAILURE; // If obj is stealthed, can no longer approach. +#else + Bool isTargetingMine = weapon && weapon->getDamageType() == DAMAGE_DISARM && + (victim->isKindOf(KINDOF_MINE) || victim->isKindOf(KINDOF_BOOBY_TRAP) || victim->isKindOf(KINDOF_DEMOTRAP)); + + if (!isTargetingMine) + return STATE_FAILURE; // If obj is stealthed, can no longer approach - unless we're targeting a mine! +#endif } ai->setCurrentVictim(victim); // Attacking an object.