Fix: hourly drug addiction did not cause proper consumption of drugs

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8621 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2018-09-24 19:39:24 +00:00
parent 494dbc6e69
commit 614d0c6c09
+17 -14
View File
@@ -458,33 +458,36 @@ void HourlyLarryUpdate()
if ( fBar ) if ( fBar )
{ {
// take $ from player's account
// silversurfer: changed the price to reflect the changed amount of 25% below
//usCashAmount = Item[ ALCOHOL ].usPrice;
usCashAmount = (UINT16)( Item[ALCOHOL].usPrice / 4.0f );
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin(), -( usCashAmount ) );
// give Larry some booze and set slot etc values appropriately // give Larry some booze and set slot etc values appropriately
// CHRISL: Change final parameter to allow dynamic control of inventory slots // CHRISL: Change final parameter to allow dynamic control of inventory slots
bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, NUM_INV_SLOTS ); bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, NUM_INV_SLOTS );
if ( bBoozeSlot != NO_SLOT ) if ( bBoozeSlot != NO_SLOT )
{ {
// take $ from player's account
// silversurfer: changed the price to reflect the changed amount of 25% below
//usCashAmount = Item[ ALCOHOL ].usPrice;
usCashAmount = (UINT16)( Item[ALCOHOL].usPrice / 4.0f );
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin(), -( usCashAmount ) );
// give Larry booze here // give Larry booze here
// silversurfer: only give the merc a 25% bottle. This fixes the problem that the bottle of alcohol can go to any inventory slot even one that isn't available. // silversurfer: only give the merc a 25% bottle. This fixes the problem that the bottle of alcohol can go to any inventory slot even one that isn't available.
// Now the bottle will be fully consumed below and vanishes from inventory before the player even gets to see it. This simulates going to a bar to have a drink there. // Now the bottle will be fully consumed below and vanishes from inventory before the player even gets to see it. This simulates going to a bar to have a drink there.
//CreateItem( ALCOHOL, 100, &(pSoldier->inv[bBoozeSlot]) );
CreateItem( ALCOHOL, 25, &( pSoldier->inv[bBoozeSlot] ) ); UINT8 portionsize = 25;
} if ( Item[ALCOHOL].usPortionSize > 0 && Item[ALCOHOL].usPortionSize < 25 )
bSlot = bBoozeSlot; portionsize = Item[ALCOHOL].usPortionSize;
if ( bSlot != NO_SLOT ) CreateItem( ALCOHOL, portionsize, &( pSoldier->inv[bBoozeSlot] ) );
{
UseKitPoints( &( pSoldier->inv[bSlot] ), 25/*LarryItems[ bLarryItemLoop ][ 2 ]*/, pSoldier ); ApplyConsumable( pSoldier, &( pSoldier->inv[bBoozeSlot] ), TRUE, FALSE );
} }
} }
else else
{ {
if ( pObj ) if ( pObj )
UseKitPoints( pObj, 100/*LarryItems[ bLarryItemLoop ][ 2 ]*/, pSoldier ); {
ApplyConsumable( pSoldier, pObj, TRUE, FALSE );
}
} }
} }
} }