From 8e85ce5acf8ca6cdf792a9f9faba4fc1b7a97fa4 Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 28 Aug 2017 22:11:02 +0000 Subject: [PATCH] When stacking ammo or kits, make the partially full object be the first instead of last on the stack git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8463 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Panels.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 96e55fab6..61f8b44d0 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -7072,6 +7072,23 @@ void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) DistributeStatus(pCursorObj, pObj, bMaxPoints); } DistributeStatus(pObj, pObj, bMaxPoints); + + // Flugente: one of the items on the stack might not be full. Make sure it is the first one, so the player can see what is missing at a glance + if ( pObj->ubNumberOfObjects > 1 ) + { + if ( Item[pObj->usItem].usItemClass & IC_AMMO ) + { + UINT16 shots_first = (*pObj)[0]->data.ubShotsLeft; + (*pObj)[0]->data.ubShotsLeft = (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft; + (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft = shots_first; + } + else if ( Item[pObj->usItem].usItemClass & IC_MAPFILTER_KIT ) + { + INT16 status_first = (*pObj)[0]->data.objectStatus; + (*pObj)[0]->data.objectStatus = (*pObj)[pObj->ubNumberOfObjects - 1]->data.objectStatus; + (*pObj)[pObj->ubNumberOfObjects - 1]->data.objectStatus = status_first; + } + } } UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs )