/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
#include <config.h>
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "nat.h"
#include "file.h"
-#include "sect.h"
-#include "nuke.h"
-#include "ship.h"
#include "land.h"
+#include "lost.h"
+#include "misc.h"
+#include "nat.h"
#include "news.h"
-#include "plane.h"
#include "nsc.h"
+#include "nuke.h"
#include "optlist.h"
+#include "plane.h"
+#include "player.h"
#include "prototypes.h"
+#include "sect.h"
+#include "ship.h"
+#include "xy.h"
static void kaboom(int x, int y, int rad, natid cn);
int
-detonate(struct plnstr *pp, int x, int y)
+detonate(struct nukstr *np, coord x, coord y, int airburst)
{
- int nuketype = pp->pln_nuketype;
- natid bombown = pp->pln_own;
- int airburst = (pp->pln_flags & PLN_AIRBURST);
+ int nuketype = np->nuk_type;
+ natid bombown = np->nuk_own;
struct nchrstr *ncp;
struct plnstr plane;
struct sctstr sect;
int rad;
struct nstr_sect ns;
struct nstr_item ni;
- int issea = 0;
+ int issea;
int retval;
- pp->pln_nuketype = -1;
getsect(x, y, §);
- if (sect.sct_type == SCT_WATER)
- issea = 1;
+ issea = sect.sct_type == SCT_WATER;
ncp = &nchr[nuketype];
kaboom(x, y, ncp->n_blast, bombown);
rad = ncp->n_blast;
if (!airburst)
rad = rad * 2 / 3;
+ np->nuk_effic = 0;
+ putnuke(np->nuk_uid, np);
+
snxtsct_dist(&ns, x, y, rad);
while (nxtsct(&ns, §)) {
/* Nukes falling on water affect only 1 sector */
mpr(own, "%s nuclear device %s\n", cname(bombown), buf2);
}
}
+
snxtitem_dist(&ni, EF_PLANE, x, y, rad);
while (nxtitem(&ni, &plane)) {
/* Nukes falling on water affect only 1 sector */
}
putplane(ni.cur, &plane);
}
+
snxtitem_dist(&ni, EF_LAND, x, y, rad);
while (nxtitem(&ni, &land)) {
/* Nukes falling on water affect only 1 sector */
}
putland(land.lnd_uid, &land);
}
+
snxtitem_dist(&ni, EF_SHIP, x, y, rad);
while (nxtitem(&ni, &ship)) {
/* Nukes falling on water affect only 1 sector */
}
putship(ship.shp_uid, &ship);
}
+
snxtitem_dist(&ni, EF_NUKE, x, y, rad);
while (nxtitem(&ni, &nuke)) {
/* Nukes falling on water affect only 1 sector */
continue;
if (roll(100) >= damage)
continue;
- makelost(EF_NUKE, nuke.nuk_own, nuke.nuk_uid, nuke.nuk_x,
- nuke.nuk_y);
- nuke.nuk_own = 0;
+ nuke.nuk_effic = 0;
if (own == bombown) {
mpr(bombown, "%s at %s destroyed\n",
prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
}
putnuke(ni.cur, &nuke);
}
+
return retval;
}