]> git.pond.sub.org Git - empserver/commitdiff
subs: Make correctness of some wu() uses more obvious
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 11 Jan 2015 13:12:37 +0000 (14:12 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 2 Mar 2015 07:20:50 +0000 (08:20 +0100)
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/attsub.c
src/lib/subs/lndsub.c

index a2f0c5c9ecb590524019fe0f35c7cd8141db6ed4..a3acccb326c045cf9d52b04f5a24c9517075c3ca 100644 (file)
@@ -1542,8 +1542,7 @@ get_osupport(char *outs, struct combat *def, int fort_sup, int ship_sup,
        ap = dam / 100.0;
        osupport += ap;
     }
-    sprintf(outs, "attacker\t%1.2f\t%1.2f\t%1.2f\t%1.2f\n", af, as, au,
-           ap);
+    sprintf(outs, "attacker\t%1.2f\t%1.2f\t%1.2f\t%1.2f", af, as, au, ap);
     return osupport;
 }
 
@@ -1590,8 +1589,8 @@ get_dsupport(char *outs, struct emp_qelem *list, struct combat *def,
     if (good)
        *outs = '\0';
     else
-       sprintf(outs, "defender\t%1.2f\t%1.2f\t%1.2f\t%1.2f\n", df, ds,
-               du, dp);
+       sprintf(outs, "defender\t%1.2f\t%1.2f\t%1.2f\t%1.2f",
+               df, ds, du, dp);
     if (def->own) {
        if (good < 0)
            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("\t\tforts\tships\tunits\tplanes\n");
        if (*osupportp != 1.0)
-           pr("%s", osupports);
+           pr("%s\n", osupports);
        if (*dsupportp != 1.0)
-           pr("%s", dsupports);
+           pr("%s\n", dsupports);
        pr("\n");
        if (def->own) {
            wu(0, def->own, "\n\t\tsupport values\n");
            wu(0, def->own, "\t\tforts\tships\tunits\tplanes\n");
            if (*osupportp != 1.0)
-               wu(0, def->own, "%s", osupports);
+               wu(0, def->own, "%s\n", osupports);
            if (*dsupportp != 1.0)
-               wu(0, def->own, "%s", dsupports);
+               wu(0, def->own, "%s\n", dsupports);
            wu(0, def->own, "\n");
        }
     }
index cfb43bc14884e2efaf72dfa0738dd570968a4a34..6a52b2385bd34a7466cabd1c13ba32140916526d 100644 (file)
@@ -362,18 +362,17 @@ intelligence_report(natid destination, struct lndstr *lp, int spy,
                int t;
                t = lp->lnd_tech - 20 + roll(40);
                t = MAX(t, 0);
-               sprintf(buf3, ", tech %d)\n", t);
+               sprintf(buf3, ", tech %d)", t);
            } else {
-               sprintf(buf3, ")\n");
+               sprintf(buf3, ")");
            }
        } else {
-           sprintf(buf2, "\n");
-           buf3[0] = 0;
+           buf2[0] = buf3[0] = 0;
        }
        if (destination == player->cnum)
            pr("%s%s%s", buf1, buf2, buf3);
        else
-           wu(0, destination, "%s%s%s", buf1, buf2, buf3);
+           wu(0, destination, "%s%s%s\n", buf1, buf2, buf3);
     }
 }