-fixed possible negative shopkeeper prices for ammo w/bullets > 100

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@304 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
MaddMugsy
2006-06-26 16:36:59 +00:00
parent df50c0e606
commit 8579bc4a24
2 changed files with 33 additions and 2 deletions
+2 -2
View File
@@ -23,12 +23,12 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" };
#else
//RELEASE BUILD VERSION
INT16 zVersionLabel[256] = { L"Release v1.13.298" };
INT16 zVersionLabel[256] = { L"Release v1.13.304" };
#endif
INT8 czVersionNumber[16] = { "Build 06.06.24" };
INT8 czVersionNumber[16] = { "Build 06.06.26" };
INT16 zTrackingNumber[16] = { L"Z" };
+31
View File
@@ -3121,6 +3121,37 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
break;
case IC_AMMO:
//Madd: quick fix for negative prices at Tony's
// this must handle overloaded objects from dealer boxes!
if ( pItemObject->ubNumberOfObjects <= MAX_OBJECTS_PER_SLOT )
{
// legal amount, count them all normally (statuses could be different)
ubItemsToCount = pItemObject->ubNumberOfObjects;
ubItemsNotCounted = 0;
// in this situation, uiUnitPrice will actually be the sum of the values of ALL the multiple objects
}
else
{
// overloaded amount, count just the first, the others must all be identical
ubItemsToCount = 1;
ubItemsNotCounted = pItemObject->ubNumberOfObjects - 1;
}
// add the value of each magazine (multiple mags may have vastly different #bullets left)
for (ubCnt = 0; ubCnt < ubItemsToCount; ubCnt++ )
{
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
(pItemObject->ubShotsLeft[ubCnt] / Magazine[ Item[ usItemID ].ubClassIndex ].ubMagSize) *
dModifier );
if ( fUnitPriceOnly )
{
// want price for only one of them. All statuses must be the same in order to use this flag!
break;
}
}
break;
default:
// this must handle overloaded objects from dealer boxes!
if ( pItemObject->ubNumberOfObjects <= MAX_OBJECTS_PER_SLOT )