From 5bb4de248431135ef30e0a7413f206e82f6ceddf Mon Sep 17 00:00:00 2001 From: Shadooow Date: Sat, 15 Jan 2022 14:08:41 +0000 Subject: [PATCH] Fixed bug where kicking out a merc and telling him to drop items in current sector while having that sector map inventory open would fail to move his items into sector inventory. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9258 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Map Screen Interface.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 0ba482d3..28a3b3b0 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -1573,18 +1573,31 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId ) if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || sectorz != gbWorldSectorZ ) { - for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter ) + if (fShowMapInventoryPool && Menptr[uiMercId].sSectorX == sSelMapX && Menptr[uiMercId].sSectorY == sSelMapY && Menptr[uiMercId].bSectorZ == iCurrentMapSectorZ) { - // slot found, - // check if actual item - if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true ) + for (UINT32 iCounter = 0; iCounter < invsize; ++iCounter) { - invTemporaryBeforeDrop[uiFoundItems] = Menptr[ uiMercId ].inv[ iCounter ]; - uiFoundItems++; + if (Menptr[uiMercId].inv[iCounter].exists()) + { + AutoPlaceObjectInInventoryStash(&Menptr[uiMercId].inv[iCounter], Menptr[uiMercId].sGridNo, Menptr[uiMercId].pathing.bLevel); + } } } - // anv: add all items at once (less file operations = less lag) - AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, sectorz, sGridNo, uiFoundItems, &(invTemporaryBeforeDrop[0]) , Menptr[ uiMercId ].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE ); + else + { + for (UINT32 iCounter = 0; iCounter < invsize; ++iCounter) + { + // slot found, + // check if actual item + if (Menptr[uiMercId].inv[iCounter].exists() == true) + { + invTemporaryBeforeDrop[uiFoundItems] = Menptr[uiMercId].inv[iCounter]; + uiFoundItems++; + } + } + // anv: add all items at once (less file operations = less lag) + AddItemsToUnLoadedSector(Menptr[uiMercId].sSectorX, Menptr[uiMercId].sSectorY, sectorz, sGridNo, uiFoundItems, &(invTemporaryBeforeDrop[0]), Menptr[uiMercId].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE); + } } else {