From 877f205b92d33a886295c55afb5b3a023b038625 Mon Sep 17 00:00:00 2001 From: Flugente Date: Fri, 13 Mar 2015 22:55:19 +0000 Subject: [PATCH] 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 --- Tactical/Handle Items.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 62f614a42..0f6529a69 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -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