mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Fix: when using two guns, both are reloaded on the reload cursor prompt, even if one of them still has ammo. This has been changed so that now only empty guns get reloaded
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9146 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+10
-4
@@ -3157,7 +3157,7 @@ INT16 GetAPsToReloadGunWithAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE * pGun, OBJEC
|
||||
return GetAPsToReload(pGun); // added by SANDRO - safety check
|
||||
}
|
||||
|
||||
INT16 GetAPsToAutoReload( SOLDIERTYPE * pSoldier )
|
||||
INT16 GetAPsToAutoReload( SOLDIERTYPE * pSoldier, bool aReloadEvenIfNotEmpty )
|
||||
{
|
||||
OBJECTTYPE * pObj;
|
||||
INT8 bSlot, bSlot2, bExcludeSlot;
|
||||
@@ -3205,11 +3205,17 @@ INT16 GetAPsToAutoReload( SOLDIERTYPE * pSoldier )
|
||||
bSlot = FindAmmoToReload( pSoldier, HANDPOS, NO_SLOT );
|
||||
if (bSlot != NO_SLOT)
|
||||
{
|
||||
// we would reload using this ammo!
|
||||
bAPCost += GetAPsToReloadGunWithAmmo( pSoldier, pObj, &(pSoldier->inv[bSlot] ) );
|
||||
// Flugente: only reload if it's empty, or we really want to
|
||||
if ( aReloadEvenIfNotEmpty || !EnoughAmmo( pSoldier, FALSE, HANDPOS ) )
|
||||
{
|
||||
// we would reload using this ammo!
|
||||
bAPCost += GetAPsToReloadGunWithAmmo( pSoldier, pObj, &( pSoldier->inv[bSlot] ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( pSoldier->IsValidSecondHandShotForReloadingPurposes( ) )
|
||||
// Flugente: only reload if it's empty, or we really want to
|
||||
if ( pSoldier->IsValidSecondHandShotForReloadingPurposes()
|
||||
&& ( aReloadEvenIfNotEmpty || !EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS ) ) )
|
||||
{
|
||||
// Flugente: check for underbarrel weapons and use that object if necessary
|
||||
pObj = pSoldier->GetUsedWeapon( &(pSoldier->inv[SECONDHANDPOS]) );
|
||||
|
||||
Reference in New Issue
Block a user