@@ -86,16 +86,17 @@ enum JetAIStateType CPP_11(: Int)
86
86
};
87
87
88
88
// -------------------------------------------------------------------------------------------------
89
- static Bool isOutOfSpecialReloadAmmo (Object* jet)
89
+ Bool JetAIUpdate:: isOutOfSpecialReloadAmmo () const
90
90
{
91
+ const Object* jet = getObject ();
91
92
// if we have at least one special reload weapon,
92
93
// AND all such weapons are out of ammo,
93
94
// return true.
94
95
Int specials = 0 ;
95
96
Int out = 0 ;
96
97
for ( Int i = 0 ; i < WEAPONSLOT_COUNT; i++ )
97
98
{
98
- Weapon* weapon = jet->getWeaponInWeaponSlot ((WeaponSlotType)i);
99
+ const Weapon* weapon = jet->getWeaponInWeaponSlot ((WeaponSlotType)i);
99
100
if (weapon == NULL || weapon->getReloadType () != RETURN_TO_BASE_TO_RELOAD)
100
101
continue ;
101
102
++specials;
@@ -300,7 +301,7 @@ class JetOrHeliCirclingDeadAirfieldState : public State
300
301
// it might not have an owning airfield, and it might be trying to return
301
302
// simply due to being idle, not out of ammo. so check and don't die in that
302
303
// case, but just punt back out to idle.
303
- if (!isOutOfSpecialReloadAmmo (jet ) && jet->getProducerID () == INVALID_ID)
304
+ if (!jetAI-> isOutOfSpecialReloadAmmo () && jet->getProducerID () == INVALID_ID)
304
305
{
305
306
return STATE_FAILURE;
306
307
}
@@ -1656,7 +1657,7 @@ UpdateSleepTime JetAIUpdate::update()
1656
1657
}
1657
1658
1658
1659
// note that we might still have weapons with ammo, but still be forced to return to reload.
1659
- if (isOutOfSpecialReloadAmmo (jet ) && getFlag (ALLOW_AIR_LOCO))
1660
+ if (isOutOfSpecialReloadAmmo () && getFlag (ALLOW_AIR_LOCO))
1660
1661
{
1661
1662
m_returnToBaseFrame = 0 ;
1662
1663
@@ -1682,7 +1683,7 @@ UpdateSleepTime JetAIUpdate::update()
1682
1683
else if (m_returnToBaseFrame != 0 && now >= m_returnToBaseFrame && getFlag (ALLOW_AIR_LOCO))
1683
1684
{
1684
1685
m_returnToBaseFrame = 0 ;
1685
- DEBUG_ASSERTCRASH (isOutOfSpecialReloadAmmo (jet ) == false , (" Hmm, this seems unlikely -- isOutOfSpecialReloadAmmo(jet )==false" ));
1686
+ DEBUG_ASSERTCRASH (isOutOfSpecialReloadAmmo () == false , (" Hmm, this seems unlikely -- isOutOfSpecialReloadAmmo()==false" ));
1686
1687
setFlag (USE_SPECIAL_RETURN_LOCO, false );
1687
1688
setLastCommandSource ( CMD_FROM_AI );
1688
1689
getStateMachine ()->setState (RETURNING_FOR_LANDING);
@@ -1700,7 +1701,7 @@ UpdateSleepTime JetAIUpdate::update()
1700
1701
}
1701
1702
m_returnToBaseFrame = 0 ;
1702
1703
if (getFlag (ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD) &&
1703
- isOutOfSpecialReloadAmmo (jet ) && getFlag (ALLOW_AIR_LOCO))
1704
+ isOutOfSpecialReloadAmmo () && getFlag (ALLOW_AIR_LOCO))
1704
1705
{
1705
1706
setFlag (USE_SPECIAL_RETURN_LOCO, true );
1706
1707
setFlag (HAS_PENDING_COMMAND, true );
@@ -2101,7 +2102,7 @@ void JetAIUpdate::doLandingCommand(Object *airfield, CommandSourceType cmdSource
2101
2102
}
2102
2103
2103
2104
getObject ()->setProducer (airfield);
2104
- DEBUG_ASSERTCRASH (isOutOfSpecialReloadAmmo (getObject ()) == false , (" Hmm, this seems unlikely -- isOutOfSpecialReloadAmmo(jet )==false" ));
2105
+ DEBUG_ASSERTCRASH (isOutOfSpecialReloadAmmo () == false , (" Hmm, this seems unlikely -- isOutOfSpecialReloadAmmo()==false" ));
2105
2106
setFlag (USE_SPECIAL_RETURN_LOCO, false );
2106
2107
setFlag (ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD, false );
2107
2108
setLastCommandSource ( cmdSource );
0 commit comments