diff --git a/GameVersion.cpp b/GameVersion.cpp index cc1b696a..70c28c5f 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -13,12 +13,12 @@ #ifdef JA2EDITOR //MAP EDITOR BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2342" }; +CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2350" }; #elif defined JA2BETAVERSION //BETA/TEST BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Debug v1.13.2342" }; +CHAR16 zVersionLabel[256] = { L"Debug v1.13.2350" }; #elif defined CRIPPLED_VERSION @@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - CHAR16 zVersionLabel[256] = { L"Release v1.13.2342" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.2350" }; #endif -CHAR8 czVersionNumber[16] = { "Build 08.09.09" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 08.09.15" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 9e3e0260..e32b0fcf 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -3087,15 +3087,19 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, UINT32 uiTotalPrice = 0; UINT32 uiDiscountValue; // UINT32 uiDifFrom10 = 0; + std::vector uiItemPrice; + uiItemPrice.resize(pItemObject->ubNumberOfObjects); - for (ubCnt = 0; ubCnt < pItemObject->ubNumberOfObjects; ubCnt++ ) { + for (ubCnt = 0; ubCnt < pItemObject->ubNumberOfObjects; ubCnt++ ) + { + uiItemPrice[ubCnt] = 0; // add up value of the main item(s), exact procedure depends on its item class switch ( Item [ usItemID ].usItemClass ) { case IC_GUN: // add value of the gun - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * + uiItemPrice[ubCnt] += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * ItemConditionModifier(usItemID, (*pItemObject)[ubCnt]->data.gun.bGunStatus) * dModifier ); @@ -3106,14 +3110,14 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, if( Item[ (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem ].usItemClass == IC_AMMO ) { // add value of its remaining ammo - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, fDealerSelling ) * + uiItemPrice[ubCnt] += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, fDealerSelling ) * ItemConditionModifier((*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, (*pItemObject)[ubCnt]->data.gun.ubGunShotsLeft) * dModifier ); } else // assume it's attached ammo (mortar shells, grenades) { // add its value (uses normal status 0-100) - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, fDealerSelling ) * + uiItemPrice[ubCnt] += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, fDealerSelling ) * ItemConditionModifier((*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, (*pItemObject)[ubCnt]->data.gun.bGunAmmoStatus) * dModifier ); } @@ -3123,7 +3127,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, case IC_AMMO: // add the value of each magazine (multiple mags may have vastly different #bullets left) // for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * + uiItemPrice[ubCnt] += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * ItemConditionModifier(usItemID, (*pItemObject)[ubCnt]->data.ubShotsLeft) * dModifier ); @@ -3131,7 +3135,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, default: // add the value of each magazine (multiple mags may have vastly different #bullets left) // for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * + uiItemPrice[ubCnt] += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * ItemConditionModifier(usItemID, (*pItemObject)[ ubCnt ]->data.objectStatus) * dModifier ); @@ -3140,54 +3144,63 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, // loop through any attachments and add in their price for (attachmentList::iterator iter = (*pItemObject)[ubCnt]->attachments.begin(); iter != (*pItemObject)[ubCnt]->attachments.end(); ++iter) { // add value of this particular attachment - uiUnitPrice += CalcShopKeeperItemPrice( fDealerSelling, fUnitPriceOnly, iter->usItem, dModifier, &(*iter)) ; + uiItemPrice[ubCnt] += CalcShopKeeperItemPrice( fDealerSelling, fUnitPriceOnly, iter->usItem, dModifier, &(*iter)) ; } - } - - - - // if Flo is doing the dealin' and wheelin' - if ( gpSMCurrentMerc->ubProfile == FLO ) - { - // if it's a GUN or AMMO (but not Launchers, and all attachments and payload is included) - switch ( Item [ usItemID ].usItemClass ) + // if Flo is doing the dealin' and wheelin' + if ( gpSMCurrentMerc->ubProfile == FLO ) { - case IC_GUN: - case IC_AMMO: - uiDiscountValue = ( uiUnitPrice * FLO_DISCOUNT_PERCENTAGE ) / 100; + // if it's a GUN or AMMO (but not Launchers, and all attachments and payload is included) + switch ( Item [ usItemID ].usItemClass ) + { + case IC_GUN: + case IC_AMMO: + uiDiscountValue = ( uiItemPrice[ubCnt] * FLO_DISCOUNT_PERCENTAGE ) / 100; - // she gets a discount! Read her M.E.R.C. profile to understand why - if ( fDealerSelling ) - { - // she buys for less... - uiUnitPrice -= uiDiscountValue; - } - else - { - // and sells for more! - uiUnitPrice += uiDiscountValue; - } - break; + // she gets a discount! Read her M.E.R.C. profile to understand why + if ( fDealerSelling ) + { + // she buys for less... + uiItemPrice[ubCnt] -= uiDiscountValue; + } + else + { + // and sells for more! + uiItemPrice[ubCnt] += uiDiscountValue; + } + break; + } } - } - - // if it's the dealer selling this, make sure the item is worth at least $1 - // if he is buying this from a player, then we allow a value of 0, since that has a special "worthless" quote #18 - if( fDealerSelling && ( uiUnitPrice == 0 ) ) - { - uiUnitPrice = 1; - } + // if it's the dealer selling this, make sure the item is worth at least $1 + // if he is buying this from a player, then we allow a value of 0, since that has a special "worthless" quote #18 + if( fDealerSelling && ( uiItemPrice[ubCnt] == 0 ) ) + { + uiItemPrice[ubCnt] = 1; + } /* - //if the price is not diviseble by 10, make it so - uiDifFrom10 = 10 - uiUnitPrice % 10; - if( uiDifFrom10 != 0 && uiDifFrom10 != 10 ) - { - uiUnitPrice += uiDifFrom10; - } + //if the price is not diviseble by 10, make it so + uiDifFrom10 = 10 - uiItemPrice[ubCnt] % 10; + if( uiDifFrom10 != 0 && uiDifFrom10 != 10 ) + { + uiItemPrice[ubCnt] += uiDifFrom10; + } */ + } + + // if we want the unit price, find the highest price in the stack + for (ubCnt = 0; ubCnt < pItemObject->ubNumberOfObjects; ubCnt++ ) + { + if(fUnitPriceOnly == TRUE) + { + uiUnitPrice = __max(uiUnitPrice, uiItemPrice[ubCnt]); + } + else + { + uiUnitPrice += uiItemPrice[ubCnt]; + } + } // we're always count the first one uiTotalPrice = uiUnitPrice; diff --git a/ja2_2005Express.vcproj b/ja2_2005Express.vcproj index c1206761..7a88381f 100644 --- a/ja2_2005Express.vcproj +++ b/ja2_2005Express.vcproj @@ -1,7 +1,7 @@