mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- changed selling price calculation for selling to locals to handle ammo
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@239 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1438,19 +1438,40 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot )
|
||||
}
|
||||
else if ( _KeyDown ( ALT ) && fSELLALL)
|
||||
{
|
||||
INT32 iPrice = 0;
|
||||
INT8 bLoop;
|
||||
|
||||
for (bLoop = 0; bLoop < gItemPointer.ubNumberOfObjects; bLoop++)
|
||||
INT32 iPrice = 0;
|
||||
|
||||
if( gItemPointer.ubNumberOfObjects > 1)
|
||||
{
|
||||
iPrice += (Item[gpItemPointer->usItem].usPrice ) * (gpItemPointer->bStatus[bLoop]/100);
|
||||
if( Item[ gpItemPointer->usItem ].usItemClass == IC_AMMO )
|
||||
{
|
||||
for (INT8 bLoop = 0; bLoop < gItemPointer.ubNumberOfObjects; bLoop++)
|
||||
{
|
||||
iPrice += (INT32)( Item[gpItemPointer->usItem].usPrice * (float) gpItemPointer->ubShotsLeft[bLoop] / Magazine[ Item[gpItemPointer->usItem].ubClassIndex ].ubMagSize );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (INT8 bLoop = 0; bLoop < gItemPointer.ubNumberOfObjects; bLoop++)
|
||||
{
|
||||
iPrice += (INT32)( Item[gpItemPointer->usItem].usPrice * (float)gpItemPointer->bStatus[bLoop] / 100 );
|
||||
}
|
||||
}
|
||||
}
|
||||
for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++)
|
||||
else
|
||||
{
|
||||
iPrice += Item[gpItemPointer->usAttachItem[bLoop]].usPrice * (gpItemPointer->bAttachStatus[bLoop]/100);
|
||||
}
|
||||
iPrice = ( Item[gpItemPointer->usItem].usPrice * gpItemPointer->bStatus[0] / 100 );
|
||||
|
||||
iPrice = (INT32) (iPrice / iPriceModifier);
|
||||
for (INT8 bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++)
|
||||
{
|
||||
iPrice += (INT32) ( Item[gpItemPointer->usAttachItem[bLoop]].usPrice * (float)gpItemPointer->bAttachStatus[bLoop] / 100);
|
||||
}
|
||||
}
|
||||
|
||||
if( iPriceModifier < 1) iPriceModifier = 1;
|
||||
|
||||
iPrice = (INT32) (iPrice / iPriceModifier);
|
||||
|
||||
AddTransactionToPlayersBook( SOLD_ITEMS, 0, GetWorldTotalMin(), iPrice );
|
||||
PlayJA2Sample( COMPUTER_BEEP2_IN, RATE_11025, 15, 1, MIDDLEPAN );
|
||||
gpItemPointer = NULL;
|
||||
|
||||
Reference in New Issue
Block a user