torpedo mission: Print rounded, not truncated hit chance
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
bfea5a2cf4
commit
89b76644b2
2 changed files with 2 additions and 3 deletions
|
@ -161,7 +161,7 @@ torp(void)
|
||||||
range = mapdist(sub.shp_x, sub.shp_y, vship.shp_x, vship.shp_y);
|
range = mapdist(sub.shp_x, sub.shp_y, vship.shp_x, vship.shp_y);
|
||||||
hitchance = shp_torp_hitchance(&sub, range);
|
hitchance = shp_torp_hitchance(&sub, range);
|
||||||
if (range <= erange) {
|
if (range <= erange) {
|
||||||
pr("Hitchance = %d%%\n", (int)(hitchance * 100));
|
pr("Hitchance = %.0f%%\n", hitchance * 100);
|
||||||
}
|
}
|
||||||
if (range > erange)
|
if (range > erange)
|
||||||
pr("Out of range\n");
|
pr("Out of range\n");
|
||||||
|
|
|
@ -487,8 +487,7 @@ perform_mission_ship(int dam, struct shpstr *sp, coord x, coord y,
|
||||||
wu(0, sp->shp_own,
|
wu(0, sp->shp_own,
|
||||||
"\tEffective torpedo range is %d.0\n", range);
|
"\tEffective torpedo range is %d.0\n", range);
|
||||||
wu(0, sp->shp_own,
|
wu(0, sp->shp_own,
|
||||||
"\tWhooosh... Hitchance = %d%%\n",
|
"\tWhooosh... Hitchance = %.0f%%\n", hitchance * 100);
|
||||||
(int)(hitchance * 100));
|
|
||||||
|
|
||||||
if (!chance(hitchance)) {
|
if (!chance(hitchance)) {
|
||||||
wu(0, sp->shp_own, "\tMissed\n");
|
wu(0, sp->shp_own, "\tMissed\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue