From 9073f66572f442b95d5f4a60e51ab834804b8e29 Mon Sep 17 00:00:00 2001 From: ChrisL Date: Tue, 21 Jun 2011 16:07:49 +0000 Subject: [PATCH] BUGFIX 536 - Fixed it so we don't lose items when attempting to hand an invalid item to an NPC. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4516 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Handle Items.cpp | 13 ++++++++----- Tactical/Interface Items.cpp | 13 +++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 360a6e17..4f4e59e6 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -4206,12 +4206,15 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) } else { + //CHRISL: The item we're handing over potentially came from an inventory slot but was placed into the cursor. So why are we deleting any remaining + // items left in the inventory slot we started from. When we moved the item from a stack into the cursor, we created a seperate stack and it's this + // new stack we should be exclusively working with. Not the stack we took items from. // Erase! - if ( bInvPos != NO_SLOT ) - { - DeleteObj(&pSoldier->inv[ bInvPos ]); - DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); - } +// if ( bInvPos != NO_SLOT ) +// { +// DeleteObj(&pSoldier->inv[ bInvPos ]); +// DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); +// } // Now intiate conv InitiateConversation( pTSoldier, pSoldier, APPROACH_GIVINGITEM, (INT32)&gTempObject ); diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 1f4c05a5..ee283d79 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -6353,15 +6353,16 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) sAPCost = GetAPsToGiveItem( gpItemPointerSoldier, usMapPos ); } + //CHRISL: This doesn't make sense to me. If we take an item out of a stack and then click on something, why would we first attempt to put the item + // back in the stack we took it from. The item in the cursor should be recognized as a seperate stack at this point. // Place it back in our hands! - gTempObject = *gpItemPointer; - if ( gbItemPointerSrcSlot != NO_SLOT ) - { - PlaceObject( gpItemPointerSoldier, gbItemPointerSrcSlot, gpItemPointer ); - fInterfacePanelDirty = DIRTYLEVEL2; - } +// if ( gbItemPointerSrcSlot != NO_SLOT ) +// { +// PlaceObject( gpItemPointerSoldier, gbItemPointerSrcSlot, gpItemPointer ); +// fInterfacePanelDirty = DIRTYLEVEL2; +// } /* //if the user just clicked on an arms dealer if( IsMercADealer( MercPtrs[ ubSoldierID ]->ubProfile ) )