Fix the price category of the newly added items

This commit is contained in:
Christof Petig 2021-03-28 09:25:51 +00:00 committed by Marcel
parent 4279720947
commit 66d0948d06
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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;
}
}