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:
parent
4c0d843c01
commit
0a962c0380
3 changed files with 25 additions and 37 deletions
|
@ -789,9 +789,8 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
if (dam > 100)
|
||||
dam = 100;
|
||||
own = land.lnd_own;
|
||||
if (own != 0)
|
||||
mpr(own, "%s pinpoint bombing raid did %d damage to %s\n",
|
||||
cname(player->cnum), dam, prland(&land));
|
||||
mpr(own, "%s pinpoint bombing raid did %d damage to %s\n",
|
||||
cname(player->cnum), dam, prland(&land));
|
||||
check_retreat_and_do_landdamage(&land, dam);
|
||||
|
||||
if (land.lnd_rflags & RET_BOMBED)
|
||||
|
|
|
@ -98,9 +98,8 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
|||
continue;
|
||||
if (type == SCT_SANCT) {
|
||||
mpr(bombown, "bounced off %s\n", xyas(ns.x, ns.y, bombown));
|
||||
if (own != 0)
|
||||
mpr(own, "%s nuclear device bounced off %s\n",
|
||||
cname(bombown), xyas(ns.x, ns.y, bombown));
|
||||
mpr(own, "%s nuclear device bounced off %s\n",
|
||||
cname(bombown), xyas(ns.x, ns.y, bombown));
|
||||
nreport(bombown, N_NUKE, own, 1);
|
||||
continue;
|
||||
}
|
||||
|
@ -191,10 +190,9 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
|||
prplane(&plane),
|
||||
xyas(plane.pln_x, plane.pln_y, own), damage);
|
||||
} else {
|
||||
if (own != 0)
|
||||
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
|
||||
cname(bombown), damage,
|
||||
prplane(&plane), xyas(plane.pln_x, plane.pln_y, own));
|
||||
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
|
||||
cname(bombown), damage,
|
||||
prplane(&plane), xyas(plane.pln_x, plane.pln_y, own));
|
||||
}
|
||||
putplane(ni.cur, &plane);
|
||||
}
|
||||
|
@ -239,10 +237,9 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
|||
mpr(bombown, "%s at %s reports %d%% damage\n",
|
||||
prland(&land), xyas(land.lnd_x, land.lnd_y, own), damage);
|
||||
} else {
|
||||
if (own != 0)
|
||||
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
|
||||
cname(bombown), damage,
|
||||
prland(&land), xyas(land.lnd_x, land.lnd_y, own));
|
||||
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
|
||||
cname(bombown), damage,
|
||||
prland(&land), xyas(land.lnd_x, land.lnd_y, own));
|
||||
}
|
||||
putland(land.lnd_uid, &land);
|
||||
}
|
||||
|
@ -281,10 +278,9 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
|||
mpr(bombown, "%s at %s reports %d%% damage\n",
|
||||
prship(&ship), xyas(ship.shp_x, ship.shp_y, own), damage);
|
||||
} else {
|
||||
if (own != 0)
|
||||
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
|
||||
cname(bombown), damage, prship(&ship),
|
||||
xyas(ship.shp_x, ship.shp_y, own));
|
||||
mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
|
||||
cname(bombown), damage, prship(&ship),
|
||||
xyas(ship.shp_x, ship.shp_y, own));
|
||||
}
|
||||
putship(ship.shp_uid, &ship);
|
||||
}
|
||||
|
@ -307,9 +303,8 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
|||
mpr(bombown, "%s at %s destroyed\n",
|
||||
prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
|
||||
} else {
|
||||
if (own != 0)
|
||||
mpr(own, "%s at %s destroyed\n",
|
||||
prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
|
||||
mpr(own, "%s at %s destroyed\n",
|
||||
prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
|
||||
}
|
||||
putnuke(ni.cur, &nuke);
|
||||
}
|
||||
|
|
|
@ -236,11 +236,9 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
att_name = "satellite";
|
||||
def_name = "a-sat missile";
|
||||
news_item = N_SAT_KILL;
|
||||
if (sect.sct_own) {
|
||||
mpr(sect.sct_own, "%s has positioned a satellite over %s\n",
|
||||
sublaunch ? "someone" : cname(bombown),
|
||||
xyas(x, y, sect.sct_own));
|
||||
}
|
||||
mpr(sect.sct_own, "%s has positioned a satellite over %s\n",
|
||||
sublaunch ? "someone" : cname(bombown),
|
||||
xyas(x, y, sect.sct_own));
|
||||
} else if (wantflags == P_N && nowantflags == P_O) {
|
||||
att_name = "warhead";
|
||||
def_name = "abm";
|
||||
|
@ -304,8 +302,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
free(qp);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -323,10 +320,9 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
mpr(sect.sct_own, "%s launched to intercept %s %s!\n",
|
||||
def_name, who, att_name);
|
||||
} else {
|
||||
if (sect.sct_own)
|
||||
mpr(sect.sct_own,
|
||||
"%s launched an %s to intercept the %s %s!\n",
|
||||
cname(pp->pln_own), def_name, who, att_name);
|
||||
mpr(sect.sct_own,
|
||||
"%s launched an %s to intercept the %s %s!\n",
|
||||
cname(pp->pln_own), def_name, who, att_name);
|
||||
mpr(pp->pln_own,
|
||||
"%s launched to intercept %s %s arcing towards %s territory!\n",
|
||||
def_name, who, att_name, cname(sect.sct_own));
|
||||
|
@ -337,8 +333,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
att_name, x, y, bombown)) {
|
||||
mpr(bombown, "%s destroyed by %s %s!\n",
|
||||
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)
|
||||
mpr(pp->pln_own, "%s %s intercepted!\n", who, att_name);
|
||||
destroyed = 1;
|
||||
|
@ -362,9 +357,8 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
if (icount) {
|
||||
mpr(bombown, "%s made it through %s defenses!\n",
|
||||
att_name, def_name);
|
||||
if (sect.sct_own)
|
||||
mpr(sect.sct_own, "%s made it through %s defenses!\n",
|
||||
att_name, def_name);
|
||||
mpr(sect.sct_own, "%s made it through %s defenses!\n",
|
||||
att_name, def_name);
|
||||
}
|
||||
return destroyed;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue