|
void AIGroup::groupDoSpecialPowerAtLocation( UnsignedInt specialPowerID, const Coord3D *location, Real angle, const Object *objectInWay, UnsignedInt commandOptions ) |
|
{ |
|
|
|
|
|
//This one requires a position |
|
std::list<Object *>::iterator i; |
|
for( i = m_memberList.begin(); i != m_memberList.end(); ) |
|
{ |
|
//Special powers do a lot of different things, but the top level stuff doesn't use |
|
//ai interface code. It finds the special power module and calls it directly for each object. |
|
|
|
Object *object = (*i); |
|
|
|
++i; // just in case the act of specialpowering changes this list, |
|
// like when the rebelambush happens over the ocean, and all the rebels drown |
|
// and, of course, their slowdeath behavior calls deselect(), which naturally |
|
// destroys the AIGroup list, in order to keep the selection sync'ed with the group. |
|
// M Lorenzen... 8/23/03 |
The last comment acknowledges that the AIGroup list can be destroyed by calling the GLA Rebel Ambush at an invalid location. In that case m_memberList would be empty after the call to doSpecialPowerAtLocation (line 2753).
If this occurs a couple of things can happen:
- One item in
m_memberList:
- VS22 Debug build: MSVC iterator assertion ("list iterators incompatible").
- VS22 / VC6 Release builds: no apparent issue.
- Two or more items in
m_memberList (probably unlikely to happen):
- VS22 Debug build: MSVC iterator assertion ("list iterators incompatible").
- VS22 / VC6 Release builds: game crashes.
VS22 Debug iterator assertion reproduction:
- Select GLA Command Center and use it to call in GLA Rebel Ambush in on invalid location like steep terrain or water.
- Be sure to use the special power button from the Command Center.
Crash reproduction (requires code changes):
- Build two GLA Command Centers.
- Select both (disable or skip our selection fixes that prevent this) and keep both selected.
- Call in GLA Rebel Ambush in on invalid location like steep terrain or water.
- Set 6th argument for
MSG_DO_SPECIAL_POWER_AT_LOCATION to INVALID_ID.
Here's a custom map and VS22 replay, which also works for VC6, that crashes the game because of this bug: vs22_special_power_selection_crash.zip
GeneralsGameCode/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp
Lines 2719 to 2736 in 4f9fafe
The last comment acknowledges that the
AIGrouplist can be destroyed by calling the GLA Rebel Ambush at an invalid location. In that casem_memberListwould be empty after the call todoSpecialPowerAtLocation(line 2753).If this occurs a couple of things can happen:
m_memberList:m_memberList(probably unlikely to happen):VS22 Debug iterator assertion reproduction:
Crash reproduction (requires code changes):
MSG_DO_SPECIAL_POWER_AT_LOCATIONtoINVALID_ID.Here's a custom map and VS22 replay, which also works for VC6, that crashes the game because of this bug: vs22_special_power_selection_crash.zip