From e84b92371467a4ffb4982eaefcec1d059ea2243c Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Fri, 19 Jun 2026 00:06:13 +0200 Subject: [PATCH] bugfix(logic): Restore retail compatibility after change in CountermeasuresBehavior::calculateCountermeasureToDivertTo. --- .../Object/Behavior/CountermeasuresBehavior.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp index 8ba6677a21a..e7dbd7fed5b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp @@ -159,8 +159,8 @@ ObjectID CountermeasuresBehavior::calculateCountermeasureToDivertTo( const Objec Real closestFlareDist = 1e15f; Object *closestFlare = nullptr; - const int volleySize = data->m_volleySize; - int volleyFlaresCounted = 0; + const UnsignedInt volleySize = max(data->m_volleySize, 1u); + UnsignedInt volleyFlaresCounted = 0; //Flares are pushed to the front of the list, but we only want to acquire the "newest" of the flares, therefore //Start at the end of the list and go towards the beginning. @@ -182,9 +182,13 @@ ObjectID CountermeasuresBehavior::calculateCountermeasureToDivertTo( const Objec // The non retail behaviour corrects the code to iterate through all flares in the volley break; #else - volleyFlaresCounted++; + ++volleyFlaresCounted; #endif } + +#if RETAIL_COMPATIBLE_CRC + ++volleyFlaresCounted; +#endif } if( closestFlare )