Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Tactical/Arms Dealer Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,20 @@ void DailyCheckOnItemQuantities()
if ( itemsAreOnOrder.count( usItemIndex ) == 0 )
{
ubMaxSupply = GetDealersMaxItemAmount( ubArmsDealer, usItemIndex );

UINT16 halfSupply = (UINT16)(ubMaxSupply / 2);
UINT16 itemsInStock = 0;
if ( numTotalItems.count(usItemIndex) > 0 )
{
itemsInStock = numTotalItems[usItemIndex];
}
//if the qty on hand is half the desired amount or fewer
if(numTotalItems.count(usItemIndex) == 1 && numTotalItems[ usItemIndex ] <= (INT32)( ubMaxSupply / 2 ) )
if( itemsInStock <= halfSupply )
{
//determine if the item can be restocked (assume new, use items aren't checked for until the stuff arrives)
if (ItemTransactionOccurs( ubArmsDealer, usItemIndex, DEALER_BUYING, FALSE ))
{
// figure out how many items to reorder (items are reordered an entire batch at a time)
ubNumItems = HowManyItemsToReorder( ubMaxSupply, numTotalItems[ usItemIndex ] );
ubNumItems = HowManyItemsToReorder( ubMaxSupply, itemsInStock);
#ifdef JA2UB
//if the dealer is betty, and we are to ADD the stuff instantly
if( ubArmsDealer == ARMS_DEALER_BETTY && fInstallyHaveItemsAppear &&
Expand Down