/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
- * Ken Stevens, Steve McClure
+ * Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Ken Stevens, Steve McClure, Markus Armbruster
*
- * This program is free software; you can redistribute it and/or modify
+ * Empire is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ---
*
* Known contributors to this file:
* Ken Stevens, 1995
* Steve McClure, 1996-2000
- * Markus Armbruster, 2004-2009
+ * Markus Armbruster, 2004-2021
*/
#include <config.h>
#include <stdlib.h>
-#include "file.h"
-#include "land.h"
+#include "chance.h"
#include "misc.h"
-#include "mission.h"
#include "nat.h"
#include "news.h"
#include "nsc.h"
#include "nuke.h"
#include "optlist.h"
-#include "path.h"
+#include "plague.h"
#include "plane.h"
-#include "player.h"
#include "prototypes.h"
#include "queue.h"
#include "sect.h"
{
struct shpstr ship;
struct nukstr nuke;
- struct sctstr sect;
int sublaunch = 0;
char *base, *in_or_at, *from;
- int dam;
mpr(pp->pln_own, "Preparing to launch %s at %s %s %s%s\n",
prplane(pp),
nuke.nuk_effic = 0;
putnuke(nuke.nuk_uid, &nuke);
}
+#if 0
+ /*
+ * Disabled for now, because it breaks callers that call
+ * msl_launch() for each member of a list of planes, created
+ * by msl_sel() or perform_mission(). Damage to the base can
+ * damage other planes. Any copies of them in the list become
+ * stale. When msl_launch() modifies and writes back such a
+ * stale copy, the damage gets wiped out, triggering a seqno
+ * oops.
+ */
if (chance(0.33)) {
- dam = pln_damage(pp, 'p', 0) / 2;
+ struct sctstr sect;
+ int dam;
+
+ dam = pln_damage(pp, 'p', NULL) / 2;
if (pp->pln_ship >= 0) {
shipdamage(&ship, dam);
putship(ship.shp_uid, &ship);
putsect(§);
}
}
+#endif
return -1;
}
hit = 1;
} else {
hitchance = pln_hitchance(pp, hardtarget, type);
- hit = (roll(100) <= hitchance);
- mpr(pp->pln_own, "\t%d%% hitchance...%s\n", hitchance,
+ hit = pct_chance(hitchance);
+ mpr(pp->pln_own, "\t%d%% hit chance...%s\n", hitchance,
hit ? "HIT!" : "miss");
}
continue;
if (plane.pln_effic < 100)
continue;
+ if (opt_MARKET) {
+ if (ontradingblock(EF_PLANE, &plane))
+ continue;
+ }
if (!pln_airbase_ok(&plane, 1, 0))
continue;
/* got a valid interceptor */
irv = malloc(sizeof(*irv));
irv->load = 0;
+ irv->pstage = PLG_HEALTHY;
irv->pcp = &plchr[(int)plane.pln_type];
irv->plane = plane;
emp_insque(&irv->queue, list);
pp = &ip->plane;
if (pp->pln_own != sp->sct_own)
continue;
- if (mission_pln_equip(ip, NULL, 'i') < 0) {
+ if (mission_pln_equip(ip, NULL, 0) < 0) {
emp_remque(qp);
free(qp);
continue;
next = qp->q_forw;
ip = (struct plist *)qp;
pp = &ip->plane;
- if (mission_pln_equip(ip, NULL, 'i') < 0) {
+ if (mission_pln_equip(ip, NULL, 0) < 0) {
emp_remque(qp);
free(qp);
continue;
struct emp_qelem irvlist;
getsect(x, y, §);
- msl_sel(&irvlist, x, y, msl->pln_own, P_N, P_O, 0);
+ msl_sel(&irvlist, x, y, msl->pln_own, P_N, 0, 0);
return msl_intercept(msl, §, sublaunch,
&irvlist, "warhead", "abm",
sublaunch ? N_NUKE_SSTOP : N_NUKE_STOP);