subs: Make correctness of some wu() uses more obvious

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-01-11 14:12:37 +01:00
parent 7be7ad98aa
commit 3aa088bb1c
2 changed files with 11 additions and 13 deletions

View file

@ -1542,8 +1542,7 @@ get_osupport(char *outs, struct combat *def, int fort_sup, int ship_sup,
ap = dam / 100.0; ap = dam / 100.0;
osupport += ap; osupport += ap;
} }
sprintf(outs, "attacker\t%1.2f\t%1.2f\t%1.2f\t%1.2f\n", af, as, au, sprintf(outs, "attacker\t%1.2f\t%1.2f\t%1.2f\t%1.2f", af, as, au, ap);
ap);
return osupport; return osupport;
} }
@ -1590,8 +1589,8 @@ get_dsupport(char *outs, struct emp_qelem *list, struct combat *def,
if (good) if (good)
*outs = '\0'; *outs = '\0';
else else
sprintf(outs, "defender\t%1.2f\t%1.2f\t%1.2f\t%1.2f\n", df, ds, sprintf(outs, "defender\t%1.2f\t%1.2f\t%1.2f\t%1.2f",
du, dp); df, ds, du, dp);
if (def->own) { if (def->own) {
if (good < 0) if (good < 0)
wu(0, def->own, wu(0, def->own,
@ -1675,17 +1674,17 @@ att_get_support(int combat_mode, int ofort, int oship, int oland,
pr("\n\t\tsupport values\n"); pr("\n\t\tsupport values\n");
pr("\t\tforts\tships\tunits\tplanes\n"); pr("\t\tforts\tships\tunits\tplanes\n");
if (*osupportp != 1.0) if (*osupportp != 1.0)
pr("%s", osupports); pr("%s\n", osupports);
if (*dsupportp != 1.0) if (*dsupportp != 1.0)
pr("%s", dsupports); pr("%s\n", dsupports);
pr("\n"); pr("\n");
if (def->own) { if (def->own) {
wu(0, def->own, "\n\t\tsupport values\n"); wu(0, def->own, "\n\t\tsupport values\n");
wu(0, def->own, "\t\tforts\tships\tunits\tplanes\n"); wu(0, def->own, "\t\tforts\tships\tunits\tplanes\n");
if (*osupportp != 1.0) if (*osupportp != 1.0)
wu(0, def->own, "%s", osupports); wu(0, def->own, "%s\n", osupports);
if (*dsupportp != 1.0) if (*dsupportp != 1.0)
wu(0, def->own, "%s", dsupports); wu(0, def->own, "%s\n", dsupports);
wu(0, def->own, "\n"); wu(0, def->own, "\n");
} }
} }

View file

@ -362,18 +362,17 @@ intelligence_report(natid destination, struct lndstr *lp, int spy,
int t; int t;
t = lp->lnd_tech - 20 + roll(40); t = lp->lnd_tech - 20 + roll(40);
t = MAX(t, 0); t = MAX(t, 0);
sprintf(buf3, ", tech %d)\n", t); sprintf(buf3, ", tech %d)", t);
} else { } else {
sprintf(buf3, ")\n"); sprintf(buf3, ")");
} }
} else { } else {
sprintf(buf2, "\n"); buf2[0] = buf3[0] = 0;
buf3[0] = 0;
} }
if (destination == player->cnum) if (destination == player->cnum)
pr("%s%s%s", buf1, buf2, buf3); pr("%s%s%s", buf1, buf2, buf3);
else else
wu(0, destination, "%s%s%s", buf1, buf2, buf3); wu(0, destination, "%s%s%s\n", buf1, buf2, buf3);
} }
} }