mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
handle numerical rounding problem more gracefully
This commit is contained in:
parent
79cc3af058
commit
0937761f21
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user