Pilots and air cargo now spread the plague

Planes flying one-way with crew or cargo spread plague from their old
base to their new base.  Planes dropping cargo spread plague from
their base to the drop's target sector.
This commit is contained in:
Markus Armbruster 2012-06-30 17:09:24 +02:00
parent a8739d86e3
commit 612ec6257d
7 changed files with 47 additions and 12 deletions

View file

@ -30,7 +30,7 @@
* Dave Pare, 1986 * Dave Pare, 1986
* Ken Stevens, 1995 * Ken Stevens, 1995
* Steve McClure, 1998 * Steve McClure, 1998
* Markus Armbruster, 2004-2010 * Markus Armbruster, 2004-2012
*/ */
#ifndef PLANE_H #ifndef PLANE_H
@ -125,6 +125,7 @@ struct plchrstr {
struct plist { struct plist {
struct emp_qelem queue; /* list of planes */ struct emp_qelem queue; /* list of planes */
int load; /* number of bombs or items carried */ int load; /* number of bombs or items carried */
short pstage; /* plague stage */
struct plchrstr *pcp; /* pointer to desc of plane */ struct plchrstr *pcp; /* pointer to desc of plane */
struct plnstr plane; /* struct plane */ struct plnstr plane; /* struct plane */
}; };

View file

@ -97,11 +97,12 @@ has been spotted.
.s1 .s1
This includes preventing any loading and unloading of ships and land This includes preventing any loading and unloading of ships and land
units (since they can, of course, carry plague), explorations out of the units (since they can, of course, carry plague), explorations out of the
sector, moving commodities out of the sector, distribution or sector, moving commodities out of the sector, even by air,
delivery, etc. Basically, any people or commodities distribution or delivery, etc. Basically, any people or commodities
that originate from a sector, ship or land unit actively battling that originate from a sector, ship or land unit actively battling
plague will cause the destination sector, ship or land unit to become plague will cause the destination sector, ship or land unit to become
infected. infected.
Beware, "people" includes pilots.
.s1 .s1
Once an outbreak has been spotted, the plague takes on an infectious Once an outbreak has been spotted, the plague takes on an infectious
state at the next update. There is very little time to isolate the state at the next update. There is very little time to isolate the

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, 2005-2011 * Markus Armbruster, 2005-2012
*/ */
#include <config.h> #include <config.h>
@ -42,6 +42,7 @@
#include "nuke.h" #include "nuke.h"
#include "optlist.h" #include "optlist.h"
#include "path.h" #include "path.h"
#include "plague.h"
#include "plane.h" #include "plane.h"
#include "ship.h" #include "ship.h"
@ -355,6 +356,7 @@ msl_equip(struct plnstr *pp, char mission)
struct plist pl; struct plist pl;
pl.load = 0; pl.load = 0;
pl.pstage = PLG_HEALTHY;
pl.pcp = plchr + pp->pln_type; pl.pcp = plchr + pp->pln_type;
pl.plane = *pp; pl.plane = *pp;
emp_initque(&pl.queue); emp_initque(&pl.queue);

View file

@ -30,7 +30,7 @@
* Dave Pare, 1986 * Dave Pare, 1986
* Thomas Ruschak, 1992 * Thomas Ruschak, 1992
* Steve McClure, 1996 * Steve McClure, 1996
* Markus Armbruster, 2006-2011 * Markus Armbruster, 2006-2012
*/ */
#include <config.h> #include <config.h>
@ -45,6 +45,7 @@
#include "nsc.h" #include "nsc.h"
#include "optlist.h" #include "optlist.h"
#include "path.h" #include "path.h"
#include "plague.h"
#include "plane.h" #include "plane.h"
#include "player.h" #include "player.h"
#include "prototypes.h" #include "prototypes.h"
@ -784,6 +785,7 @@ getilists(struct emp_qelem *list, unsigned char *rel, natid intruder)
/* got one! */ /* got one! */
ip = malloc(sizeof(*ip)); ip = malloc(sizeof(*ip));
ip->load = 0; ip->load = 0;
ip->pstage = PLG_HEALTHY;
ip->pcp = &plchr[(int)plane.pln_type]; ip->pcp = &plchr[(int)plane.pln_type];
ip->plane = plane; ip->plane = plane;
emp_insque(&ip->queue, &list[plane.pln_own]); emp_insque(&ip->queue, &list[plane.pln_own]);

View file

@ -29,7 +29,7 @@
* Known contributors to this file: * Known contributors to this file:
* Ken Stevens, 1995 * Ken Stevens, 1995
* Steve McClure, 1996-2000 * Steve McClure, 1996-2000
* Markus Armbruster, 2003-2011 * Markus Armbruster, 2003-2012
*/ */
#include <config.h> #include <config.h>
@ -44,6 +44,7 @@
#include "nsc.h" #include "nsc.h"
#include "optlist.h" #include "optlist.h"
#include "path.h" #include "path.h"
#include "plague.h"
#include "prototypes.h" #include "prototypes.h"
#include "queue.h" #include "queue.h"
#include "xy.h" #include "xy.h"
@ -330,6 +331,7 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
continue; continue;
plp = malloc(sizeof(struct plist)); plp = malloc(sizeof(struct plist));
plp->load = 0; plp->load = 0;
plp->pstage = PLG_HEALTHY;
plp->pcp = &plchr[(int)plane.pln_type]; plp->pcp = &plchr[(int)plane.pln_type];
plp->plane = plane; plp->plane = plane;
emp_insque(&plp->queue, escorts); emp_insque(&plp->queue, escorts);
@ -372,6 +374,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
/* save planes for later */ /* save planes for later */
plp = malloc(sizeof(struct plist)); plp = malloc(sizeof(struct plist));
plp->load = 0; plp->load = 0;
plp->pstage = PLG_HEALTHY;
plp->pcp = pcp; plp->pcp = pcp;
memcpy(&plp->plane, glp->thing, sizeof(struct plnstr)); memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
if (plp->pcp->pl_flags & P_M) if (plp->pcp->pl_flags & P_M)
@ -893,12 +896,15 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, char mission)
pcp = plp->pcp; pcp = plp->pcp;
if (pp->pln_ship >= 0) { if (pp->pln_ship >= 0) {
getship(pp->pln_ship, &ship); getship(pp->pln_ship, &ship);
plp->pstage = ship.shp_pstage;
item = ship.shp_item; item = ship.shp_item;
} else if (pp->pln_land >= 0) { } else if (pp->pln_land >= 0) {
getland(pp->pln_land, &land); getland(pp->pln_land, &land);
plp->pstage = land.lnd_pstage;
item = land.lnd_item; item = land.lnd_item;
} else { } else {
getsect(pp->pln_x, pp->pln_y, &sect); getsect(pp->pln_x, pp->pln_y, &sect);
plp->pstage = sect.sct_pstage;
item = sect.sct_item; item = sect.sct_item;
} }
if (pcp->pl_fuel > item[I_PETROL]) { if (pcp->pl_fuel > item[I_PETROL]) {

View file

@ -29,7 +29,7 @@
* Known contributors to this file: * Known contributors to this file:
* Ken Stevens, 1995 * Ken Stevens, 1995
* Steve McClure, 1996-2000 * Steve McClure, 1996-2000
* Markus Armbruster, 2004-2010 * Markus Armbruster, 2004-2012
*/ */
#include <config.h> #include <config.h>
@ -42,6 +42,7 @@
#include "nsc.h" #include "nsc.h"
#include "nuke.h" #include "nuke.h"
#include "optlist.h" #include "optlist.h"
#include "plague.h"
#include "plane.h" #include "plane.h"
#include "prototypes.h" #include "prototypes.h"
#include "queue.h" #include "queue.h"
@ -224,6 +225,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
/* got a valid interceptor */ /* got a valid interceptor */
irv = malloc(sizeof(*irv)); irv = malloc(sizeof(*irv));
irv->load = 0; irv->load = 0;
irv->pstage = PLG_HEALTHY;
irv->pcp = &plchr[(int)plane.pln_type]; irv->pcp = &plchr[(int)plane.pln_type];
irv->plane = plane; irv->plane = plane;
emp_insque(&irv->queue, list); emp_insque(&irv->queue, list);

View file

@ -45,6 +45,7 @@
#include "nsc.h" #include "nsc.h"
#include "nuke.h" #include "nuke.h"
#include "optlist.h" #include "optlist.h"
#include "plague.h"
#include "plane.h" #include "plane.h"
#include "player.h" #include "player.h"
#include "prototypes.h" #include "prototypes.h"
@ -236,6 +237,9 @@ pln_newlanding(struct emp_qelem *list, coord tx, coord ty, int cno)
cname(player->cnum), prplane(&plp->plane), cname(player->cnum), prplane(&plp->plane),
prship(&ship)); prship(&ship));
} }
if (plp->pcp->pl_crew && plp->pstage == PLG_INFECT
&& ship.shp_pstage == PLG_HEALTHY)
ship.shp_pstage = PLG_EXPOSED;
} }
} else { } else {
plp->plane.pln_x = tx; plp->plane.pln_x = tx;
@ -247,6 +251,9 @@ pln_newlanding(struct emp_qelem *list, coord tx, coord ty, int cno)
cname(player->cnum), cname(player->cnum),
prplane(&plp->plane), xyas(tx, ty, sect.sct_own)); prplane(&plp->plane), xyas(tx, ty, sect.sct_own));
} }
if (plp->pcp->pl_crew && plp->pstage == PLG_INFECT
&& sect.sct_pstage == PLG_HEALTHY)
sect.sct_pstage = PLG_EXPOSED;
plp->plane.pln_ship = cno; plp->plane.pln_ship = cno;
} }
} }
@ -263,14 +270,10 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
struct shpstr ship; struct shpstr ship;
int there; int there;
int max; int max;
int pstage;
if (!ip) if (!ip)
return; return;
amt = 0;
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
plp = (struct plist *)qp;
amt += plp->load;
}
if (cno < 0) { if (cno < 0) {
getsect(tx, ty, &sect); getsect(tx, ty, &sect);
if (!sect.sct_own) { if (!sect.sct_own) {
@ -292,11 +295,23 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
} }
there = sect.sct_item[ip->i_uid]; there = sect.sct_item[ip->i_uid];
max = ITEM_MAX; max = ITEM_MAX;
pstage = sect.sct_pstage;
} else { } else {
getship(cno, &ship); getship(cno, &ship);
there = ship.shp_item[ip->i_uid]; there = ship.shp_item[ip->i_uid];
max = mchr[ship.shp_type].m_item[ip->i_uid]; max = mchr[ship.shp_type].m_item[ip->i_uid];
pstage = ship.shp_pstage;
} }
amt = 0;
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
plp = (struct plist *)qp;
amt += plp->load;
if (plp->load
&& plp->pstage == PLG_INFECT && pstage == PLG_HEALTHY)
pstage = PLG_EXPOSED;
}
there += amt; there += amt;
if (there > max) { if (there > max) {
pr("%d excess %s discarded\n", there - max, ip->i_name); pr("%d excess %s discarded\n", there - max, ip->i_name);
@ -306,6 +321,7 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
pr("%d %s landed safely", amt, ip->i_name); pr("%d %s landed safely", amt, ip->i_name);
if (cno < 0) { if (cno < 0) {
sect.sct_item[ip->i_uid] = there; sect.sct_item[ip->i_uid] = there;
sect.sct_pstage = pstage;
if (sect.sct_own != player->cnum) if (sect.sct_own != player->cnum)
wu(0, sect.sct_own, "%s planes drop %d %s in %s\n", wu(0, sect.sct_own, "%s planes drop %d %s in %s\n",
cname(player->cnum), amt, ip->i_name, cname(player->cnum), amt, ip->i_name,
@ -314,6 +330,7 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
putsect(&sect); putsect(&sect);
} else { } else {
ship.shp_item[ip->i_uid] = there; ship.shp_item[ip->i_uid] = there;
ship.shp_pstage = pstage;
if (ship.shp_own != player->cnum) if (ship.shp_own != player->cnum)
wu(0, ship.shp_own, "%s planes land %d %s on carrier %d\n", wu(0, ship.shp_own, "%s planes land %d %s on carrier %d\n",
cname(player->cnum), amt, ip->i_name, ship.shp_uid); cname(player->cnum), amt, ip->i_name, ship.shp_uid);
@ -576,6 +593,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
putplane(plane.pln_uid, &plane); putplane(plane.pln_uid, &plane);
plp = malloc(sizeof(struct plist)); plp = malloc(sizeof(struct plist));
plp->load = 0; plp->load = 0;
plp->pstage = PLG_HEALTHY;
plp->pcp = pcp; plp->pcp = pcp;
plp->plane = plane; plp->plane = plane;
emp_insque(&plp->queue, list); emp_insque(&plp->queue, list);
@ -626,14 +644,17 @@ pln_equip(struct plist *plp, struct ichrstr *ip, char mission)
pcp = plp->pcp; pcp = plp->pcp;
if (pp->pln_ship >= 0) { if (pp->pln_ship >= 0) {
getship(pp->pln_ship, &ship); getship(pp->pln_ship, &ship);
plp->pstage = ship.shp_pstage;
item = ship.shp_item; item = ship.shp_item;
own = ship.shp_own; own = ship.shp_own;
} else if (pp->pln_land >= 0) { } else if (pp->pln_land >= 0) {
getland(pp->pln_land, &land); getland(pp->pln_land, &land);
plp->pstage = land.lnd_pstage;
item = land.lnd_item; item = land.lnd_item;
own = land.lnd_own; own = land.lnd_own;
} else { } else {
getsect(pp->pln_x, pp->pln_y, &sect); getsect(pp->pln_x, pp->pln_y, &sect);
plp->pstage = sect.sct_pstage;
item = sect.sct_item; item = sect.sct_item;
own = sect.sct_oldown; own = sect.sct_oldown;
} }