Fix for grenades being put into inventory instead back into hand if the soldier is stopped from throwing it in middle of animation by game (interrupt/spotting another enemy).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9311 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Shadooow
2022-02-28 22:23:33 +00:00
parent 851f82e2db
commit a184f76753
+19 -8
View File
@@ -14183,15 +14183,26 @@ void SOLDIERTYPE::HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy )
// OK, check if we were going to throw something, and give it back if so!
if ( this->pTempObject != NULL && fFromSightingEnemy )
{
// Place it back into inv....
AutoPlaceObject( this, this->pTempObject, FALSE );
if ( this->pThrowParams->ubActionCode == THROW_ARM_ITEM )
{
if (!this->inv[HANDPOS].exists())
{
// put the one-handed weapon in the guy's hand...
if (!PlaceObject(this, HANDPOS, this->pTempObject))
{
AutoPlaceObject(this, this->pTempObject, FALSE);
}
}
//AXP 25.03.2007: Not needed anymore, grenade costs are only deducted on throwing the object
//AXP 24.03.2007: Give APs back if we wanted to throw grenade, but interrupt/spotting occured
//DeductPoints( this, -MinAPsToAttack( this, this->sTargetGridNo, FALSE ), 0 );
}
else
{
// Place it back into inv....
AutoPlaceObject(this, this->pTempObject, FALSE);
}
//AXP 25.03.2007: Not needed anymore, grenade costs are only deducted on throwing the object
//AXP 24.03.2007: Give APs back if we wanted to throw grenade, but interrupt/spotting occured
//if ( this->pThrowParams->ubActionCode == THROW_ARM_ITEM )
//{
// DeductPoints( this, -MinAPsToAttack( this, this->sTargetGridNo, FALSE ), 0 );
//}
OBJECTTYPE::DeleteMe( &this->pTempObject );
this->usPendingAnimation = NO_PENDING_ANIMATION;