Fix pre-tax unit market price loss of precision

check_trade() converts the price to float, which can lose precision,
although only for ridiculously high prices.  Has been broken since
4.0.0 introduced the market.

Avoid the conversion.  Bulletins now show pre-tax price as $N instead
of $N.00.
This commit is contained in:
Markus Armbruster 2013-01-14 20:52:04 +01:00
parent 5f46ced826
commit 9c78e724ab

View file

@ -283,7 +283,7 @@ check_trade(void)
union empobj_storage tg;
time_t now;
double tleft;
float price;
int price;
int saveid;
natid seller;
@ -338,7 +338,7 @@ check_trade(void)
wu(0, seller,
" Your item was taken off the market.\n");
wu(0, trade.trd_maxbidder,
"You tried to buy %s #%d from %s for $%.2f\n",
"You tried to buy %s #%d from %s for $%d\n",
trade_nameof(&trade, &tg.gen), saveid, cname(seller),
price);
wu(0, trade.trd_maxbidder, "but couldn't afford it.\n");
@ -403,7 +403,7 @@ check_trade(void)
cname(trade.trd_maxbidder), trade_nameof(&trade, &tg.gen),
saveid, price * tradetax);
wu(0, trade.trd_maxbidder,
"The bidding is over & you bought %s #%d from %s for $%.2f\n",
"The bidding is over & you bought %s #%d from %s for $%d\n",
trade_nameof(&trade, &tg.gen), saveid, cname(seller),
price);
}