]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/arm.c
Update copyright notice
[empserver] / src / lib / commands / arm.c
index 86635b265974c768b7d3b953d854d785a24f6d54..62b30abaa6bf170dd6799332664a9124fadb9112 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2009, 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,
@@ -14,8 +14,7 @@
  *  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/>.
  *
  *  ---
  *
@@ -31,7 +30,7 @@
  *     Dave Pare, 1986
  *     Ken Stevens, 1995
  *     Steve McClure, 2000
- *     Markus Armbruster, 2006-2009
+ *     Markus Armbruster, 2006-2011
  */
 
 #include <config.h>
@@ -59,7 +58,7 @@ arm(void)
        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_N | P_MAR))
@@ -103,6 +102,11 @@ arm(void)
               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;
@@ -150,7 +154,7 @@ disarm(void)
        }
        getsect(nuke.nuk_x, nuke.nuk_y, &sect);
        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;