From d6b7dd4d52096fb92318d828bda9264fd2b5ffa0 Mon Sep 17 00:00:00 2001 From: Flugente Date: Fri, 30 Dec 2016 00:09:15 +0000 Subject: [PATCH] Fix: when buying gear kits from AIM/MERC, prices are incorrect for item stacks git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8349 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/AimMembers.cpp | 8 +++++++- Laptop/mercs Files.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 09749c66..d6a4fdb7 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -5972,8 +5972,14 @@ void WeaponKitSelectionUpdate(UINT8 selectedInventory = 0) //get the item usItem = gMercProfiles[ gbCurrentSoldier ].inv[ uiLoop ]; + // for an item stack, we obviously need to account fot the number of items + // for single items, the number is not always set, so just to be sure... + int number = 1; + if ( gMercProfileGear[gbCurrentSoldier][selectedInventory].iNumber.size( ) >= uiLoop ) + number = max( 1, gMercProfileGear[gbCurrentSoldier][selectedInventory].iNumber[uiLoop] ); + //add the cost - tempGearCost += Item[ usItem ].usPrice; + tempGearCost += number * Item[usItem].usPrice; } } //tais: added optional price modifier for gearkits, reads the xml tag mPriceMod from MercStartingGear.xml diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 864180cd..0c84ddf9 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1854,8 +1854,14 @@ void MercWeaponKitSelectionUpdate(UINT8 selectedInventory) //get the item usItem = gMercProfiles[ ubMercID ].inv[ uiLoop ]; + // for an item stack, we obviously need to account fot the number of items + // for single items, the number is not always set, so just to be sure... + int number = 1; + if ( gMercProfileGear[ubMercID][selectedInventory].iNumber.size( ) >= uiLoop ) + number = max( 1, gMercProfileGear[ubMercID][selectedInventory].iNumber[uiLoop] ); + //add the cost - tempGearCost += Item[ usItem ].usPrice; + tempGearCost += number * Item[usItem].usPrice; } } //tais: added optional price modifier for gearkits, reads the xml tag mPriceMod from MercStartingGear.xml