mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Updated the shopkeeper display so that items being offered for sale by the shopkeeper display their highest unit cost instead of the stack cost.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2350 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+4
-4
@@ -13,12 +13,12 @@
|
|||||||
#ifdef JA2EDITOR
|
#ifdef JA2EDITOR
|
||||||
|
|
||||||
//MAP EDITOR BUILD VERSION
|
//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
|
#elif defined JA2BETAVERSION
|
||||||
|
|
||||||
//BETA/TEST BUILD VERSION
|
//BETA/TEST BUILD VERSION
|
||||||
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2342" };
|
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2350" };
|
||||||
|
|
||||||
#elif defined CRIPPLED_VERSION
|
#elif defined CRIPPLED_VERSION
|
||||||
|
|
||||||
@@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
//RELEASE BUILD VERSION
|
//RELEASE BUILD VERSION
|
||||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.2342" };
|
CHAR16 zVersionLabel[256] = { L"Release v1.13.2350" };
|
||||||
|
|
||||||
#endif
|
#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" };
|
CHAR16 zTrackingNumber[16] = { L"Z" };
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3087,15 +3087,19 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
|
|||||||
UINT32 uiTotalPrice = 0;
|
UINT32 uiTotalPrice = 0;
|
||||||
UINT32 uiDiscountValue;
|
UINT32 uiDiscountValue;
|
||||||
// UINT32 uiDifFrom10 = 0;
|
// UINT32 uiDifFrom10 = 0;
|
||||||
|
std::vector<UINT32> 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
|
// add up value of the main item(s), exact procedure depends on its item class
|
||||||
switch ( Item [ usItemID ].usItemClass )
|
switch ( Item [ usItemID ].usItemClass )
|
||||||
{
|
{
|
||||||
case IC_GUN:
|
case IC_GUN:
|
||||||
// add value of the 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) *
|
ItemConditionModifier(usItemID, (*pItemObject)[ubCnt]->data.gun.bGunStatus) *
|
||||||
dModifier );
|
dModifier );
|
||||||
|
|
||||||
@@ -3106,14 +3110,14 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
|
|||||||
if( Item[ (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem ].usItemClass == IC_AMMO )
|
if( Item[ (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem ].usItemClass == IC_AMMO )
|
||||||
{
|
{
|
||||||
// add value of its remaining 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) *
|
ItemConditionModifier((*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, (*pItemObject)[ubCnt]->data.gun.ubGunShotsLeft) *
|
||||||
dModifier );
|
dModifier );
|
||||||
}
|
}
|
||||||
else // assume it's attached ammo (mortar shells, grenades)
|
else // assume it's attached ammo (mortar shells, grenades)
|
||||||
{
|
{
|
||||||
// add its value (uses normal status 0-100)
|
// 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) *
|
ItemConditionModifier((*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, (*pItemObject)[ubCnt]->data.gun.bGunAmmoStatus) *
|
||||||
dModifier );
|
dModifier );
|
||||||
}
|
}
|
||||||
@@ -3123,7 +3127,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
|
|||||||
case IC_AMMO:
|
case IC_AMMO:
|
||||||
// add the value of each magazine (multiple mags may have vastly different #bullets left)
|
// add the value of each magazine (multiple mags may have vastly different #bullets left)
|
||||||
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
|
// 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) *
|
ItemConditionModifier(usItemID, (*pItemObject)[ubCnt]->data.ubShotsLeft) *
|
||||||
dModifier );
|
dModifier );
|
||||||
|
|
||||||
@@ -3131,7 +3135,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
|
|||||||
default:
|
default:
|
||||||
// add the value of each magazine (multiple mags may have vastly different #bullets left)
|
// add the value of each magazine (multiple mags may have vastly different #bullets left)
|
||||||
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
|
// 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) *
|
ItemConditionModifier(usItemID, (*pItemObject)[ ubCnt ]->data.objectStatus) *
|
||||||
dModifier );
|
dModifier );
|
||||||
|
|
||||||
@@ -3140,54 +3144,63 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
|
|||||||
// loop through any attachments and add in their price
|
// loop through any attachments and add in their price
|
||||||
for (attachmentList::iterator iter = (*pItemObject)[ubCnt]->attachments.begin(); iter != (*pItemObject)[ubCnt]->attachments.end(); ++iter) {
|
for (attachmentList::iterator iter = (*pItemObject)[ubCnt]->attachments.begin(); iter != (*pItemObject)[ubCnt]->attachments.end(); ++iter) {
|
||||||
// add value of this particular attachment
|
// 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 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 )
|
|
||||||
{
|
{
|
||||||
case IC_GUN:
|
// if it's a GUN or AMMO (but not Launchers, and all attachments and payload is included)
|
||||||
case IC_AMMO:
|
switch ( Item [ usItemID ].usItemClass )
|
||||||
uiDiscountValue = ( uiUnitPrice * FLO_DISCOUNT_PERCENTAGE ) / 100;
|
{
|
||||||
|
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
|
// she gets a discount! Read her M.E.R.C. profile to understand why
|
||||||
if ( fDealerSelling )
|
if ( fDealerSelling )
|
||||||
{
|
{
|
||||||
// she buys for less...
|
// she buys for less...
|
||||||
uiUnitPrice -= uiDiscountValue;
|
uiItemPrice[ubCnt] -= uiDiscountValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// and sells for more!
|
// and sells for more!
|
||||||
uiUnitPrice += uiDiscountValue;
|
uiItemPrice[ubCnt] += uiDiscountValue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// if it's the dealer selling this, make sure the item is worth at least $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 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 ) )
|
||||||
if( fDealerSelling && ( uiUnitPrice == 0 ) )
|
{
|
||||||
{
|
uiItemPrice[ubCnt] = 1;
|
||||||
uiUnitPrice = 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//if the price is not diviseble by 10, make it so
|
//if the price is not diviseble by 10, make it so
|
||||||
uiDifFrom10 = 10 - uiUnitPrice % 10;
|
uiDifFrom10 = 10 - uiItemPrice[ubCnt] % 10;
|
||||||
if( uiDifFrom10 != 0 && uiDifFrom10 != 10 )
|
if( uiDifFrom10 != 0 && uiDifFrom10 != 10 )
|
||||||
{
|
{
|
||||||
uiUnitPrice += uiDifFrom10;
|
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
|
// we're always count the first one
|
||||||
uiTotalPrice = uiUnitPrice;
|
uiTotalPrice = uiUnitPrice;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="8,00"
|
Version="8.00"
|
||||||
Name="ja2_2005Express"
|
Name="ja2_2005Express"
|
||||||
ProjectGUID="{F44669E7-74AC-444B-B75F-F16F4B9F0265}"
|
ProjectGUID="{F44669E7-74AC-444B-B75F-F16F4B9F0265}"
|
||||||
RootNamespace="ja2_2005Express"
|
RootNamespace="ja2_2005Express"
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
|
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
|
||||||
OutputFile="$(OutDir)\ja2_debug_2292_en.exe"
|
OutputFile="$(OutDir)\ja2_debug_2350_en.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
|
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
|
||||||
OutputFile="$(OutDir)\ja2_release_2296_en.exe"
|
OutputFile="$(OutDir)\ja2_release_2350_en.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
GenerateMapFile="true"
|
GenerateMapFile="true"
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
|
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
|
||||||
OutputFile="$(OutDir)\Map Editor_2292_en.exe"
|
OutputFile="$(OutDir)\Map Editor_2350_en.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
GenerateMapFile="true"
|
GenerateMapFile="true"
|
||||||
|
|||||||
Reference in New Issue
Block a user