Skip to content

Commit 4ecef76

Browse files
authored
bugfix(script): Fix game crash with AICommandInterface::aiAttackPosition when executing scripted fire weapon commands (#1440)
1 parent eedb3b6 commit 4ecef76

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5435,7 +5435,8 @@ void Object::doCommandButton( const CommandButton *commandButton, CommandSourceT
54355435
{
54365436
setWeaponLock( commandButton->getWeaponSlot(), LOCKED_TEMPORARILY );
54375437
//LOCATION BASED FIRE WEAPON
5438-
ai->aiAttackPosition( NULL, commandButton->getMaxShotsToFire(), cmdSource );
5438+
// TheSuperHackers @bugfix Caball009 09/08/2025 Position should be irrelevant, but aiAttackPosition requires a valid position pointer to avoid a crash.
5439+
ai->aiAttackPosition( getPosition(), commandButton->getMaxShotsToFire(), cmdSource );
54395440
}
54405441
else
54415442
{

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ void FireWeaponPower::doSpecialPower( UnsignedInt commandOptions )
109109
AIUpdateInterface *ai = self->getAI();
110110
if( ai )
111111
{
112-
ai->aiAttackPosition( NULL, data->m_maxShotsToFire, CMD_FROM_AI );
112+
// TheSuperHackers @bugfix Caball009 09/08/2025 Position should be irrelevant, but aiAttackPosition requires a valid position pointer to avoid a crash.
113+
ai->aiAttackPosition( self->getPosition(), data->m_maxShotsToFire, CMD_FROM_AI );
113114

114115
//Order any turrets to attack as well.
115116
for( Int i = 0; i < MAX_TURRETS; i++ )

0 commit comments

Comments
 (0)