Simplify calls to mpr()

mpr() does nothing when its first argument is zero.  No need to avoid
calling it in that case; remove the conditionals.
This commit is contained in:
Markus Armbruster 2008-03-22 11:04:53 +01:00
parent 4c0d843c01
commit 0a962c0380
3 changed files with 25 additions and 37 deletions

View file

@ -789,7 +789,6 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
if (dam > 100) if (dam > 100)
dam = 100; dam = 100;
own = land.lnd_own; own = land.lnd_own;
if (own != 0)
mpr(own, "%s pinpoint bombing raid did %d damage to %s\n", mpr(own, "%s pinpoint bombing raid did %d damage to %s\n",
cname(player->cnum), dam, prland(&land)); cname(player->cnum), dam, prland(&land));
check_retreat_and_do_landdamage(&land, dam); check_retreat_and_do_landdamage(&land, dam);

View file

@ -98,7 +98,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
continue; continue;
if (type == SCT_SANCT) { if (type == SCT_SANCT) {
mpr(bombown, "bounced off %s\n", xyas(ns.x, ns.y, bombown)); mpr(bombown, "bounced off %s\n", xyas(ns.x, ns.y, bombown));
if (own != 0)
mpr(own, "%s nuclear device bounced off %s\n", mpr(own, "%s nuclear device bounced off %s\n",
cname(bombown), xyas(ns.x, ns.y, bombown)); cname(bombown), xyas(ns.x, ns.y, bombown));
nreport(bombown, N_NUKE, own, 1); nreport(bombown, N_NUKE, own, 1);
@ -191,7 +190,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
prplane(&plane), prplane(&plane),
xyas(plane.pln_x, plane.pln_y, own), damage); xyas(plane.pln_x, plane.pln_y, own), damage);
} else { } else {
if (own != 0)
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n", mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
cname(bombown), damage, cname(bombown), damage,
prplane(&plane), xyas(plane.pln_x, plane.pln_y, own)); prplane(&plane), xyas(plane.pln_x, plane.pln_y, own));
@ -239,7 +237,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
mpr(bombown, "%s at %s reports %d%% damage\n", mpr(bombown, "%s at %s reports %d%% damage\n",
prland(&land), xyas(land.lnd_x, land.lnd_y, own), damage); prland(&land), xyas(land.lnd_x, land.lnd_y, own), damage);
} else { } else {
if (own != 0)
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n", mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
cname(bombown), damage, cname(bombown), damage,
prland(&land), xyas(land.lnd_x, land.lnd_y, own)); prland(&land), xyas(land.lnd_x, land.lnd_y, own));
@ -281,7 +278,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
mpr(bombown, "%s at %s reports %d%% damage\n", mpr(bombown, "%s at %s reports %d%% damage\n",
prship(&ship), xyas(ship.shp_x, ship.shp_y, own), damage); prship(&ship), xyas(ship.shp_x, ship.shp_y, own), damage);
} else { } else {
if (own != 0)
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n", mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
cname(bombown), damage, prship(&ship), cname(bombown), damage, prship(&ship),
xyas(ship.shp_x, ship.shp_y, own)); xyas(ship.shp_x, ship.shp_y, own));
@ -307,7 +303,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
mpr(bombown, "%s at %s destroyed\n", mpr(bombown, "%s at %s destroyed\n",
prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own)); prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
} else { } else {
if (own != 0)
mpr(own, "%s at %s destroyed\n", mpr(own, "%s at %s destroyed\n",
prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own)); prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
} }

View file

@ -236,11 +236,9 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
att_name = "satellite"; att_name = "satellite";
def_name = "a-sat missile"; def_name = "a-sat missile";
news_item = N_SAT_KILL; news_item = N_SAT_KILL;
if (sect.sct_own) {
mpr(sect.sct_own, "%s has positioned a satellite over %s\n", mpr(sect.sct_own, "%s has positioned a satellite over %s\n",
sublaunch ? "someone" : cname(bombown), sublaunch ? "someone" : cname(bombown),
xyas(x, y, sect.sct_own)); xyas(x, y, sect.sct_own));
}
} else if (wantflags == P_N && nowantflags == P_O) { } else if (wantflags == P_N && nowantflags == P_O) {
att_name = "warhead"; att_name = "warhead";
def_name = "abm"; def_name = "abm";
@ -304,7 +302,6 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
free(qp); free(qp);
} }
if (icount == 0) { if (icount == 0) {
if (sect.sct_own != 0)
mpr(sect.sct_own, "No %ss launched to intercept.\n", def_name); mpr(sect.sct_own, "No %ss launched to intercept.\n", def_name);
return destroyed; return destroyed;
} }
@ -323,7 +320,6 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
mpr(sect.sct_own, "%s launched to intercept %s %s!\n", mpr(sect.sct_own, "%s launched to intercept %s %s!\n",
def_name, who, att_name); def_name, who, att_name);
} else { } else {
if (sect.sct_own)
mpr(sect.sct_own, mpr(sect.sct_own,
"%s launched an %s to intercept the %s %s!\n", "%s launched an %s to intercept the %s %s!\n",
cname(pp->pln_own), def_name, who, att_name); cname(pp->pln_own), def_name, who, att_name);
@ -337,7 +333,6 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
att_name, x, y, bombown)) { att_name, x, y, bombown)) {
mpr(bombown, "%s destroyed by %s %s!\n", mpr(bombown, "%s destroyed by %s %s!\n",
att_name, cname(pp->pln_own), def_name); att_name, cname(pp->pln_own), def_name);
if (sect.sct_own)
mpr(sect.sct_own, "%s %s intercepted!\n", who, att_name); mpr(sect.sct_own, "%s %s intercepted!\n", who, att_name);
if (sect.sct_own != pp->pln_own) if (sect.sct_own != pp->pln_own)
mpr(pp->pln_own, "%s %s intercepted!\n", who, att_name); mpr(pp->pln_own, "%s %s intercepted!\n", who, att_name);
@ -362,7 +357,6 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
if (icount) { if (icount) {
mpr(bombown, "%s made it through %s defenses!\n", mpr(bombown, "%s made it through %s defenses!\n",
att_name, def_name); att_name, def_name);
if (sect.sct_own)
mpr(sect.sct_own, "%s made it through %s defenses!\n", mpr(sect.sct_own, "%s made it through %s defenses!\n",
att_name, def_name); att_name, def_name);
} }