torpedo mission: Print rounded, not truncated hit chance

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-03-08 14:58:04 +01:00
parent bfea5a2cf4
commit 89b76644b2
2 changed files with 2 additions and 3 deletions

View file

@ -161,7 +161,7 @@ torp(void)
range = mapdist(sub.shp_x, sub.shp_y, vship.shp_x, vship.shp_y);
hitchance = shp_torp_hitchance(&sub, range);
if (range <= erange) {
pr("Hitchance = %d%%\n", (int)(hitchance * 100));
pr("Hitchance = %.0f%%\n", hitchance * 100);
}
if (range > erange)
pr("Out of range\n");

View file

@ -487,8 +487,7 @@ perform_mission_ship(int dam, struct shpstr *sp, coord x, coord y,
wu(0, sp->shp_own,
"\tEffective torpedo range is %d.0\n", range);
wu(0, sp->shp_own,
"\tWhooosh... Hitchance = %d%%\n",
(int)(hitchance * 100));
"\tWhooosh... Hitchance = %.0f%%\n", hitchance * 100);
if (!chance(hitchance)) {
wu(0, sp->shp_own, "\tMissed\n");