mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
FindAmmoToReload: added assert messages to indicate that searching attached weapon failed.
DecideAction: initialize bWeaponMode = WM_NORMAL to prevent FindAmmoToReload from crashing. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8892 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+10
-7
@@ -3804,19 +3804,22 @@ INT8 FindAmmoToReload( SOLDIERTYPE * pSoldier, INT8 bWeaponIn, INT8 bExcludeSlot
|
|||||||
{
|
{
|
||||||
return( NO_SLOT );
|
return( NO_SLOT );
|
||||||
}
|
}
|
||||||
if(pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO)//dnl ch63 230813
|
|
||||||
|
if (pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO)//dnl ch63 230813
|
||||||
{
|
{
|
||||||
pObj = FindAttachment_GrenadeLauncher(&pSoldier->inv[bWeaponIn]);
|
pObj = FindAttachment_GrenadeLauncher(&pSoldier->inv[bWeaponIn]);
|
||||||
|
AssertMsg(pObj, "FindAmmoToReload: could not find attached grenade launcher.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Flugente: check for underbarrel weapons and use that object if necessary
|
// Flugente: check for underbarrel weapons and use that object if necessary
|
||||||
pObj = pSoldier->GetUsedWeapon( &(pSoldier->inv[bWeaponIn]) );
|
pObj = pSoldier->GetUsedWeapon(&(pSoldier->inv[bWeaponIn]));
|
||||||
|
AssertMsg(pObj, "FindAmmoToReload: could not find underbarrel weapon.");
|
||||||
|
|
||||||
//<SB> manual recharge
|
//<SB> manual recharge
|
||||||
if ((*pObj)[0]->data.gun.ubGunShotsLeft && !((*pObj)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
if ((*pObj)[0]->data.gun.ubGunShotsLeft && !((*pObj)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER))
|
||||||
return bWeaponIn;
|
return bWeaponIn;
|
||||||
//</SB>
|
//</SB>
|
||||||
}
|
}
|
||||||
if ( Item[pObj->usItem].usItemClass == IC_GUN && !Item[pObj->usItem].cannon )
|
if ( Item[pObj->usItem].usItemClass == IC_GUN && !Item[pObj->usItem].cannon )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -707,6 +707,8 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
|||||||
pSoldier->bStealthMode = FALSE;
|
pSoldier->bStealthMode = FALSE;
|
||||||
// disable reverse movement mode
|
// disable reverse movement mode
|
||||||
pSoldier->bReverse = FALSE;
|
pSoldier->bReverse = FALSE;
|
||||||
|
// sevenfm: initialize data
|
||||||
|
pSoldier->bWeaponMode = WM_NORMAL;
|
||||||
|
|
||||||
BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP || pSoldier->aiData.bNeutral || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) );
|
BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP || pSoldier->aiData.bNeutral || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) );
|
||||||
BOOLEAN fCivilianOrMilitia = PTR_CIV_OR_MILITIA;
|
BOOLEAN fCivilianOrMilitia = PTR_CIV_OR_MILITIA;
|
||||||
@@ -1555,6 +1557,8 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
|||||||
pSoldier->bStealthMode = FALSE;
|
pSoldier->bStealthMode = FALSE;
|
||||||
// disable reverse movement mode
|
// disable reverse movement mode
|
||||||
pSoldier->bReverse = FALSE;
|
pSoldier->bReverse = FALSE;
|
||||||
|
// sevenfm: initialize data
|
||||||
|
pSoldier->bWeaponMode = WM_NORMAL;
|
||||||
|
|
||||||
if (fCivilian || (gGameExternalOptions.fAllNamedNpcsDecideAction && pSoldier->ubProfile != NO_PROFILE))
|
if (fCivilian || (gGameExternalOptions.fAllNamedNpcsDecideAction && pSoldier->ubProfile != NO_PROFILE))
|
||||||
{
|
{
|
||||||
@@ -2478,6 +2482,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier)
|
|||||||
pSoldier->bStealthMode = FALSE;
|
pSoldier->bStealthMode = FALSE;
|
||||||
// disable reverse movement mode
|
// disable reverse movement mode
|
||||||
pSoldier->bReverse = FALSE;
|
pSoldier->bReverse = FALSE;
|
||||||
|
// sevenfm: initialize data
|
||||||
|
pSoldier->bWeaponMode = WM_NORMAL;
|
||||||
|
|
||||||
// if we have absolutely no action points, we can't do a thing under RED!
|
// if we have absolutely no action points, we can't do a thing under RED!
|
||||||
if ( pSoldier->bActionPoints <= 0 ) //Action points can be negative
|
if ( pSoldier->bActionPoints <= 0 ) //Action points can be negative
|
||||||
@@ -4855,6 +4861,8 @@ INT16 ubMinAPCost;
|
|||||||
pSoldier->bStealthMode = FALSE;
|
pSoldier->bStealthMode = FALSE;
|
||||||
// disable reverse movement mode
|
// disable reverse movement mode
|
||||||
pSoldier->bReverse = FALSE;
|
pSoldier->bReverse = FALSE;
|
||||||
|
// sevenfm: initialize data
|
||||||
|
pSoldier->bWeaponMode = WM_NORMAL;
|
||||||
|
|
||||||
// sevenfm: stop flanking when we see enemy
|
// sevenfm: stop flanking when we see enemy
|
||||||
if( AICheckIsFlanking(pSoldier) )
|
if( AICheckIsFlanking(pSoldier) )
|
||||||
@@ -7113,6 +7121,13 @@ INT8 ArmedVehicleDecideAction( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
INT8 bAction = AI_ACTION_NONE;
|
INT8 bAction = AI_ACTION_NONE;
|
||||||
|
|
||||||
|
// sevenfm: disable stealth mode
|
||||||
|
pSoldier->bStealthMode = FALSE;
|
||||||
|
// disable reverse movement mode
|
||||||
|
pSoldier->bReverse = FALSE;
|
||||||
|
// sevenfm: initialize data
|
||||||
|
pSoldier->bWeaponMode = WM_NORMAL;
|
||||||
|
|
||||||
switch ( pSoldier->aiData.bAlertStatus )
|
switch ( pSoldier->aiData.bAlertStatus )
|
||||||
{
|
{
|
||||||
case STATUS_GREEN:
|
case STATUS_GREEN:
|
||||||
|
|||||||
Reference in New Issue
Block a user