Fix: When defusing a gun trap, the attached gun vanished

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7782 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-03-13 22:55:19 +00:00
parent b92524da77
commit 877f205b92
+20
View File
@@ -5542,6 +5542,26 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
}
else
{
// if this is a tripwire, it might have an attached gun, which we also have to spawn
if ( Item[gTempObject.usItem].tripwire )
{
// search for attached guns
OBJECTTYPE* pAttGun = NULL;
// check all attachments
attachmentList::iterator iterend = gTempObject[0]->attachments.end( );
for ( attachmentList::iterator iter = gTempObject[0]->attachments.begin( ); iter != iterend; ++iter )
{
if ( iter->exists( ) && Item[iter->usItem].usItemClass == IC_GUN )
{
pAttGun = &(*iter);
// add this gun to the floor
AddItemToPool( gsBoobyTrapGridNo, pAttGun, 1, gbBoobyTrapLevel, 0, -1 );
}
}
}
// switch action item to the real item type
// sevenfm: added check to only switch action items and not regular explosives
// this allows to keep all attachments