/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
- * Ken Stevens, Steve McClure
+ * Copyright (C) 1986-2020, 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/>.
*
* ---
*
* ---
*
* arm.c: Arm planes (missiles) with nuclear devices
- *
+ *
* Known contributors to this file:
* Dave Pare, 1986
* Ken Stevens, 1995
* Steve McClure, 2000
- * Markus Armbruster, 2006-2008
+ * Markus Armbruster, 2006-2011
*/
#include <config.h>
return RET_SYN;
while (nxtitem(&ni, &pl)) {
if (!player->owner
- && getrel(getnatp(pl.pln_own), player->cnum) != ALLIED)
+ && relations_with(pl.pln_own, player->cnum) != ALLIED)
continue;
plc = &plchr[(int)pl.pln_type];
- if ((plc->pl_flags & (P_O | P_M)) == (P_O | P_M)) {
+ if ((plc->pl_flags & (P_O | P_N | P_MAR))
+ || (plc->pl_flags & (P_M | P_F)) == (P_M | P_F)) {
pr("A %s cannot carry nuclear devices!\n", plc->pl_name);
return RET_FAIL;
}
prnuke(&nuke), nuke.nuk_plane);
return RET_FAIL;
}
+ if (nuke.nuk_x != pl.pln_x || nuke.nuk_y != pl.pln_y) {
+ pr("%s isn't in the same sector as %s!\n",
+ prnuke(&nuke), prplane(&pl));
+ return RET_FAIL;
+ }
if (*p == 'y' || *p == 'Y')
pl.pln_flags |= PLN_AIRBURST;
else
pl.pln_flags &= ~PLN_AIRBURST;
+ pl.pln_mission = 0;
snprintf(buf, sizeof(buf), "armed on your %s in %s",
prplane(&pl), xyas(pl.pln_x, pl.pln_y, pl.pln_own));
}
getsect(nuke.nuk_x, nuke.nuk_y, §);
if (!player->owner
- && getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
+ && relations_with(sect.sct_own, player->cnum) != ALLIED) {
pr("Disarming %s in sector %s requires an alliance!\n",
prplane(&pl), xyas(sect.sct_x, sect.sct_y, player->cnum));
continue;