Skip to content

Commit a585917

Browse files
authored
bugfix(logic): Restore retail compatibility after change in CountermeasuresBehavior::calculateCountermeasureToDivertTo (TheSuperHackers#2808)
1 parent e577fad commit a585917

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ ObjectID CountermeasuresBehavior::calculateCountermeasureToDivertTo( const Objec
159159
Real closestFlareDist = 1e15f;
160160
Object *closestFlare = nullptr;
161161

162-
const int volleySize = data->m_volleySize;
163-
int volleyFlaresCounted = 0;
162+
const UnsignedInt volleySize = max(data->m_volleySize, 1u);
163+
UnsignedInt volleyFlaresCounted = 0;
164164

165165
//Flares are pushed to the front of the list, but we only want to acquire the "newest" of the flares, therefore
166166
//Start at the end of the list and go towards the beginning.
@@ -182,9 +182,13 @@ ObjectID CountermeasuresBehavior::calculateCountermeasureToDivertTo( const Objec
182182
// The non retail behaviour corrects the code to iterate through all flares in the volley
183183
break;
184184
#else
185-
volleyFlaresCounted++;
185+
++volleyFlaresCounted;
186186
#endif
187187
}
188+
189+
#if RETAIL_COMPATIBLE_CRC
190+
++volleyFlaresCounted;
191+
#endif
188192
}
189193

190194
if( closestFlare )

0 commit comments

Comments
 (0)