bomb: Disallow bombing spy units

When bombing land units, the bombers get a chance to spot spies.  They
can target one even when it wasn't spotted.  This makes no sense.
Screwed up when spy units were added in 4.0.0.  Hide them completely.
They can still be killed via collateral damage.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-05-14 22:15:21 +02:00
parent 08ffefab17
commit 7688aed77a

View file

@ -30,7 +30,7 @@
* Dave Pare, 1986 * Dave Pare, 1986
* Ken Stevens, 1995 * Ken Stevens, 1995
* Steve McClure, 1998-2000 * Steve McClure, 1998-2000
* Markus Armbruster, 2004-2015 * Markus Armbruster, 2004-2016
*/ */
#include <config.h> #include <config.h>
@ -194,7 +194,7 @@ pin_bomb(struct emp_qelem *list, struct sctstr *target)
pr("Some subs are present in the sector.\n"); pr("Some subs are present in the sector.\n");
} }
nplanes = planesatxy(target->sct_x, target->sct_y, 0, 0); nplanes = planesatxy(target->sct_x, target->sct_y, 0, 0);
nunits = unitsatxy(target->sct_x, target->sct_y, 0, 0); nunits = unitsatxy(target->sct_x, target->sct_y, 0, L_SPY);
retry: retry:
p = getstring("Bomb what? (ship, plane, land unit, efficiency, commodities) ", p = getstring("Bomb what? (ship, plane, land unit, efficiency, commodities) ",
buf); buf);
@ -599,7 +599,7 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
plp = (struct plist *)qp; plp = (struct plist *)qp;
if (changed_plane_aborts(plp)) if (changed_plane_aborts(plp))
continue; continue;
nunits = unitsatxy(target->sct_x, target->sct_y, 0, 0); nunits = unitsatxy(target->sct_x, target->sct_y, 0, L_SPY);
if (nunits == 0) { if (nunits == 0) {
pr("%s could not find any units!\n", prplane(&plp->plane)); pr("%s could not find any units!\n", prplane(&plp->plane));
continue; continue;
@ -615,7 +615,7 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
if (*q == '~') if (*q == '~')
break; break;
if (*q == '?') { if (*q == '?') {
unitsatxy(target->sct_x, target->sct_y, 0, 0); unitsatxy(target->sct_x, target->sct_y, 0, L_SPY);
continue; continue;
} }
n = atoi(q); n = atoi(q);
@ -623,6 +623,7 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
continue; continue;
if (getland(n, &land) && land.lnd_own && if (getland(n, &land) && land.lnd_own &&
land.lnd_ship < 0 && land.lnd_land < 0 && land.lnd_ship < 0 && land.lnd_land < 0 &&
!(lchr[land.lnd_type].l_flags & L_SPY) &&
land.lnd_x == target->sct_x && land.lnd_y == target->sct_y) land.lnd_x == target->sct_x && land.lnd_y == target->sct_y)
unitno = n; unitno = n;
else else