Skip to main content

sell

Function sell 

Source
pub fn sell<const N: usize, S>(
    provider: &S,
    shop_id: &S::ShopId,
    inv: &mut Inventory<S::Item, N>,
    money: &mut u32,
    item: S::Item,
    quantity: u32,
) -> Result<ShopReceipt, ShopError>
where S: ShopProvider,
Expand description

Sell quantity units of item for the shop’s ShopProvider::sell_price.

Bookkeeping only: verifies the shop will buy the item and the player owns enough, then removes the item and credits money. On any error nothing is mutated.