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
This commit is contained in:
Flugente
2017-08-28 22:11:02 +00:00
parent 52558851f9
commit 8e85ce5acf
+17
View File
@@ -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 )