Do not cast to float where default argument promotion obviously

converts the cast's result to double.  Such casts are ugly and may
lose precision.
This commit is contained in:
Markus Armbruster 2006-05-06 08:34:33 +00:00
parent 7a99405942
commit f819e7ac85
4 changed files with 12 additions and 12 deletions

View file

@ -64,9 +64,8 @@ lsta(void)
pr("%4d %-16.16s ", land.lnd_uid, lchr[(int)land.lnd_type].l_name);
prxy("%4d,%-4d", land.lnd_x, land.lnd_y, player->cnum);
pr(" %3d%% %3d %1.1f %1.1f %3d ",
land.lnd_effic,
land.lnd_tech,
(float)land.lnd_att, (float)land.lnd_def, land.lnd_vul);
land.lnd_effic, land.lnd_tech, land.lnd_att, land.lnd_def,
land.lnd_vul);
pr("%2d %2d %2d %2d ",
land.lnd_spd, land.lnd_vis, land.lnd_spy, land.lnd_rad);
pr("%2d %2d %2d %2d %2d ",

View file

@ -364,14 +364,14 @@ check_trade(void)
wu(0, trade.trd_owner,
"%s tried to buy a %s #%d from you for $%.2f\n",
cname(trade.trd_maxbidder), trade_nameof(&trade, &tg),
saveid, (float)(price * tradetax));
saveid, price * tradetax);
wu(0, trade.trd_owner, " but couldn't afford it.\n");
wu(0, trade.trd_owner,
" Your item was taken off the market.\n");
wu(0, trade.trd_maxbidder,
"You tried to buy %s #%d from %s for $%.2f\n",
trade_nameof(&trade, &tg), saveid, cname(trade.trd_owner),
(float)(price * tradetax));
price * tradetax);
wu(0, trade.trd_maxbidder, "but couldn't afford it.\n");
continue;
}
@ -483,11 +483,11 @@ check_trade(void)
nreport(trade.trd_owner, N_MAKE_SALE, trade.trd_maxbidder, 1);
wu(0, trade.trd_owner, "%s bought a %s #%d from you for $%.2f\n",
cname(trade.trd_maxbidder), trade_nameof(&trade, &tg),
saveid, (float)(price * tradetax));
saveid, price * tradetax);
wu(0, trade.trd_maxbidder,
"The bidding is over & you bought %s #%d from %s for $%.2f\n",
trade_nameof(&trade, &tg), saveid, cname(trade.trd_owner),
(float)price);
price);
}
/* logerror("Done checking the trades.\n");*/
return RET_OK;

View file

@ -169,11 +169,11 @@ vers(void)
pr("Ships on autonavigation may use %i cargo holds per ship.\n", TMAX);
if (opt_TRADESHIPS) {
pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
trade_1_dist, (float)(trade_1 * 100.0));
trade_1_dist, trade_1 * 100.0);
pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
trade_2_dist, (float)(trade_2 * 100.0));
trade_2_dist, trade_2 * 100.0);
pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
trade_3_dist, (float)(trade_3 * 100.0));
trade_3_dist, trade_3 * 100.0);
pr("Cashing in trade-ships with an ally nets you a %.1f%% bonus.\n",
trade_ally_bonus * 100.0);
pr("Cashing in trade-ships with an ally nets your ally a %.1f%% bonus.\n\n",

View file

@ -468,8 +468,9 @@ show_land_stats(int tlev)
ourtlev = (int)(tlev - lcp->l_tech);
pr("%-25s %1.1f %1.1f %3d ",
lcp->l_name, (float)LND_ATTDEF(lcp->l_att, ourtlev),
(float)LND_ATTDEF(lcp->l_def, ourtlev),
lcp->l_name,
LND_ATTDEF(lcp->l_att, ourtlev),
LND_ATTDEF(lcp->l_def, ourtlev),
(int)LND_VUL(lcp->l_vul, ourtlev));
pr("%2d %2d %2d %2d ",
(int)LND_SPD(lcp->l_spd, ourtlev),