2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * arm.c: Arm planes (missiles) with nuclear devices
30 * Known contributors to this file:
62 if (!snxtitem(&ni, EF_PLANE, player->argp[1]))
64 while (nxtitem(&ni, &pl)) {
67 plc = &plchr[(int)pl.pln_type];
68 if ((plc->pl_flags & (P_O | P_M)) == (P_O | P_M)) {
69 pr("A %s cannot carry nuclear devices!\n", plc->pl_name);
73 if (ontradingblock(EF_PLANE, &pl)) {
74 pr("You cannot disarm %s while it is on the trading block!\n",
79 if (pl.pln_nuketype < 0) {
80 sprintf(prompt, "Nuclear device for %s: ", prplane(&pl));
81 p = getstarg(player->argp[2], prompt, buf);
84 if (!check_plane_ok(&pl))
87 if (!getnuke(nukno, &nuke) || !player->owner)
90 if (nuk_on_plane(&nuke, pl.pln_uid) < 0) {
95 ncp = &nchr[nuke.nuk_type];
96 if (pl.pln_load < ncp->n_weight) {
97 pr("A %s cannot carry %s devices!\n",
98 plc->pl_name, ncp->n_name);
101 p = getstarg(player->argp[3], "Airburst [n]? ", buf);
103 if (!check_plane_ok(&pl) || !check_nuke_ok(&nuke))
106 if (p && (*p == 'y' || *p == 'Y'))
107 pl.pln_flags |= PLN_AIRBURST;
109 pl.pln_flags &= ~PLN_AIRBURST;
111 pl.pln_nuketype = nuke.nuk_type;
112 nuke.nuk_plane = pl.pln_uid;
113 putplane(pl.pln_uid, &pl);
114 putnuke(nuke.nuk_uid, &nuke);
115 pr("%s armed with %s.\n", prplane(&pl), prnuke(&nuke));
116 pr("Warhead on %s is programmed to %s\n",
118 pl.pln_flags & PLN_AIRBURST ? "airburst" : "groundburst");
131 if (!snxtitem(&ni, EF_PLANE, player->argp[1]))
133 while (nxtitem(&ni, &pl)) {
136 if (pl.pln_nuketype == -1)
139 if (ontradingblock(EF_PLANE, &pl)) {
140 pr("You cannot disarm %s while it is on the trading block!\n",
145 if (nuk_on_plane(&nuke, pl.pln_uid) < 0) {
150 pl.pln_nuketype = -1;
151 pl.pln_flags &= ~PLN_AIRBURST;
152 putplane(pl.pln_uid, &pl);
153 putnuke(nuke.nuk_uid, &nuke);
154 pr("%s removed from %s and added to %s\n",
155 prnuke(&nuke), prplane(&pl),
156 xyas(pl.pln_x, pl.pln_y, player->cnum));