When trading, mark items that the trader won't buy.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8367 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-01-15 23:48:34 +00:00
parent 87809f222f
commit ec52ab30e5
2 changed files with 34 additions and 6 deletions
+10
View File
@@ -344,6 +344,8 @@ BOOLEAN TransformationMenuPopup_Arm_TestValid(OBJECTTYPE * pObj);
void BombInventoryMessageBoxCallBack( UINT8 ubExitValue );
void BombInventoryDisArmMessageBoxCallBack( UINT8 ubExitValue );
extern BOOLEAN DoesCurrentDealerRefuseToTradeItem( UINT16 usItem );
// sevenfm:
// delayed grenade explosion
BOOLEAN TransformationMenuPopup_DelayedGrenadeExplosion_TestValid(OBJECTTYPE* pObj);
@@ -2767,6 +2769,14 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe
UINT32 uiWhichBuffer = ( guiCurrentItemDescriptionScreen == MAP_SCREEN ) ? guiSAVEBUFFER : guiRENDERBUFFER;
DrawHatchOnInventory( uiWhichBuffer, sX, sY, (UINT16)(gSMInvData[ sPocket ].sWidth-1), (UINT16)(gSMInvData[ sPocket ].sHeight-1) );
}
// Flugente: if we are currently trading, hatch all items that the trade won't accept anyway in red. That way the player doesn't have to manually find out
else if ( (guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE) && pObject->exists( ) && DoesCurrentDealerRefuseToTradeItem( pObject->usItem ) )
{
UINT16 usColor = Get16BPPColor( FROMRGB( 150, 0, 50 ) );
UINT32 uiWhichBuffer = (guiCurrentItemDescriptionScreen == MAP_SCREEN) ? guiSAVEBUFFER : guiRENDERBUFFER;
DrawHatchOnInventory_MilitiaAccess( uiWhichBuffer, sX, sY, (UINT16)(gSMInvData[sPocket].sWidth - 1), (UINT16)(gSMInvData[sPocket].sHeight - 1), usColor );
}
// if there's an item in there
if ( pObject->exists() )
+24 -6
View File
@@ -6712,18 +6712,16 @@ void ConfirmToDeductMoneyFromPlayersAccountMessageBoxCallBack( UINT8 bExitValue
gubSkiDirtyLevel = SKI_DIRTY_LEVEL2;
}
// run through what the player has on the table and see if the shop keep will aceept it or not
BOOLEAN WillShopKeeperRejectObjectsFromPlayer( INT8 bDealerId, INT8 bSlotId )
BOOLEAN WillShopKeeperRejectItemFromPlayer( INT8 bDealerId, UINT16 usItem )
{
BOOLEAN fRejected = TRUE;
if( Item[ PlayersOfferArea[ bSlotId ].sItemIndex ].usItemClass == IC_MONEY )
if ( Item[usItem].usItemClass == IC_MONEY )
{
fRejected = FALSE;
}
else if( CanDealerTransactItem( gbSelectedArmsDealerID, PlayersOfferArea[ bSlotId ].sItemIndex, TRUE ) )
else if ( CanDealerTransactItem( gbSelectedArmsDealerID, usItem, TRUE ) )
{
fRejected = FALSE;
}
@@ -6733,9 +6731,29 @@ BOOLEAN WillShopKeeperRejectObjectsFromPlayer( INT8 bDealerId, INT8 bSlotId )
fRejected = TRUE;
}
return( fRejected );
return fRejected;
}
BOOLEAN DoesCurrentDealerRefuseToTradeItem( UINT16 usItem )
{
//if non-repairman
if ( armsDealerInfo[gbSelectedArmsDealerID].ubTypeOfArmsDealer != ARMS_DEALER_REPAIRS )
{
// don't evaluate anything he wouldn't buy!
if ( WillShopKeeperRejectItemFromPlayer( gbSelectedArmsDealerID, usItem ) )
{
return TRUE;
}
}
return FALSE;
}
// run through what the player has on the table and see if the shop keep will aceept it or not
BOOLEAN WillShopKeeperRejectObjectsFromPlayer( INT8 bDealerId, INT8 bSlotId )
{
return WillShopKeeperRejectItemFromPlayer( bDealerId, PlayersOfferArea[bSlotId].sItemIndex );
}
void CheckAndHandleClearingOfPlayerOfferArea( void )
{