diff --git a/common/src/comp/inventory/trade_pricing.rs b/common/src/comp/inventory/trade_pricing.rs index f4094aadb8..1e2ddeb3ee 100644 --- a/common/src/comp/inventory/trade_pricing.rs +++ b/common/src/comp/inventory/trade_pricing.rs @@ -115,6 +115,8 @@ impl TradePricing { _ if name.starts_with("common.items.ore.") => &self.ingredients, _ if name.starts_with("common.items.flowers.") => &self.ingredients, _ if name.starts_with("common.items.crafting_tools.") => &self.other, + _ if name.starts_with("common.items.lantern.") => &self.other, + _ if name.starts_with("common.items.tool.") => &self.tools, _ => { info!("unknown loot item {}", name); &self.other @@ -135,6 +137,8 @@ impl TradePricing { _ if name.starts_with("common.items.ore.") => &mut self.ingredients, _ if name.starts_with("common.items.flowers.") => &mut self.ingredients, _ if name.starts_with("common.items.crafting_tools.") => &mut self.other, + _ if name.starts_with("common.items.lantern.") => &mut self.other, + _ if name.starts_with("common.items.tool.") => &mut self.tools, _ => { info!("unknown loot item {}", name); &mut self.other diff --git a/world/src/sim2/mod.rs b/world/src/sim2/mod.rs index 01c31fd7c5..4235ffa96b 100644 --- a/world/src/sim2/mod.rs +++ b/world/src/sim2/mod.rs @@ -568,7 +568,7 @@ fn trade_at_site( break; } } - let paid_amount = allocated_amount - balance / *price; + let mut paid_amount = allocated_amount - balance / *price; if paid_amount / allocated_amount < 0.95 { debug!( "Client {} is broke on {:?} : {} {} severity {}", @@ -581,7 +581,6 @@ fn trade_at_site( } else { debug!("bought {:?} {} {}", *g, paid_amount, *price); } - good_delivery[*g] += paid_amount; if economy.stocks[*g] - paid_amount < 0.0 { info!( "BUG {:?} {:?} {} TO {:?} OSR {:?} ND {:?}", @@ -592,8 +591,9 @@ fn trade_at_site( order_stock_ratio, next_demand[*g] ); + paid_amount = economy.stocks[*g]; } - assert!(economy.stocks[*g] - paid_amount >= 0.0); + good_delivery[*g] += paid_amount; economy.stocks[*g] -= paid_amount; } }