Don't use multiple calls of wu() to print a single line, because that
creates a separate bulletin for each part. The read command normally
merges the bulletins, but if the bulletins are more than five seconds
apart (clock jumped somehow), we get a bulletin header in the middle
of a line. Unlikely to happen, but it also messes up pln_damage()'s
line wrapping (see commit
e002bf2). Clean it up.
The wu() misuse was introduced in Empire 2.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
* Known contributors to this file:
* Ken Stevens, 1995
* Steve McClure, 1996-2000
* Known contributors to this file:
* Ken Stevens, 1995
* Steve McClure, 1996-2000
- * Markus Armbruster, 2003-2012
+ * Markus Armbruster, 2003-2015
struct plist *plp;
struct plnstr *pp;
int newdam, dam = 0;
struct plist *plp;
struct plnstr *pp;
int newdam, dam = 0;
int hitchance;
for (qp = bombers->q_forw; qp != bombers; qp = qp->q_forw) {
int hitchance;
for (qp = bombers->q_forw; qp != bombers; qp = qp->q_forw) {
"\t%s pinbombing %s %s in %s\n",
prplane(pp), cname(victim), s, xyas(x, y, pp->pln_own));
}
"\t%s pinbombing %s %s in %s\n",
prplane(pp), cname(victim), s, xyas(x, y, pp->pln_own));
}
- hitchance = pln_hitchance(pp, hardtarget, EF_SHIP);
if (nuk_on_plane(&plp->plane) >= 0)
hitchance = 100;
if (nuk_on_plane(&plp->plane) >= 0)
hitchance = 100;
- else if (hardtarget != SECT_HARDTARGET)
- wu(0, pp->pln_own, "\t\t%d%% hitchance...", hitchance);
+ else {
+ hitchance = pln_hitchance(pp, hardtarget, EF_SHIP);
+ if (hardtarget != SECT_HARDTARGET)
+ snprintf(buf, sizeof(buf), "\t\t%d%% hitchance...",
+ hitchance);
+ }
if (pct_chance(hitchance)) {
if (pct_chance(hitchance)) {
- newdam = pln_damage(&plp->plane, 'p', "");
+ newdam = pln_damage(&plp->plane, 'p', buf);
wu(0, pp->pln_own,
"\t\thit %s %s for %d damage\n",
cname(victim), s, newdam);
dam += newdam;
} else {
wu(0, pp->pln_own,
"\t\thit %s %s for %d damage\n",
cname(victim), s, newdam);
dam += newdam;
} else {
- newdam = pln_damage(&plp->plane, 'p', 0);
- wu(0, pp->pln_own, "missed\n");
+ newdam = pln_damage(&plp->plane, 'p', NULL);
+ wu(0, pp->pln_own, "%smissed\n", buf);
if (mission == MI_SINTERDICT) {
mpr(victim,
"RUMBLE... your sub in %s hears a depth-charge explode nearby\n",
if (mission == MI_SINTERDICT) {
mpr(victim,
"RUMBLE... your sub in %s hears a depth-charge explode nearby\n",