From 9c78e724abec8a162bc71c92cb44c9eebf0fc010 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 14 Jan 2013 20:52:04 +0100 Subject: [PATCH] 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. --- src/lib/commands/trad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/commands/trad.c b/src/lib/commands/trad.c index a53da4d1e..fa122e8b0 100644 --- a/src/lib/commands/trad.c +++ b/src/lib/commands/trad.c @@ -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); } -- 2.43.0