damage: Shield embarked planes and land units from sector damage

Damage to a ship or land unit, say via pinpoint bombing, doesn't
damage loaded planes and land units.

Damage to a sector, say via strategic bombing, doesn't damage ships
there, but it does damage planes, even when loaded on a land unit (but
not when loaded on a ship), and land units, even when loaded on a land
unit or a ship.

This makes no sense.  Sector damage spills over to land units that way
since Chainsaw 3 added them, and to planes since 4.0.9.

Change sectdamage() not to damage land units and planes loaded on
ships or land units.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2018-05-10 17:55:50 +02:00
parent b109430b8c
commit 7d8e2aed16
5 changed files with 74 additions and 87 deletions

View file

@ -29,6 +29,7 @@
* Known contributors to this file:
* Dave Pare, 1989
* Steve McClure, 1996
* Markus Armbruster, 2006-2018
*/
#include <config.h>
@ -96,6 +97,8 @@ sectdamage(struct sctstr *sp, int dam)
while (nxtitem(&ni, &land)) {
if (!land.lnd_own)
continue;
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
continue;
landdamage(&land, dam);
putland(land.lnd_uid, &land);
}
@ -109,7 +112,7 @@ sectdamage(struct sctstr *sp, int dam)
continue;
if (plane.pln_flags & PLN_LAUNCHED)
continue;
if (plane.pln_ship >= 0)
if (plane.pln_ship >= 0 || plane.pln_land >= 0)
continue;
planedamage(&plane, dam);
putplane(plane.pln_uid, &plane);