/*
* 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-2011, 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:
* Steve McClure, 2000
- * Markus Armbruster, 2006
+ * Markus Armbruster, 2006-2011
*/
#include <config.h>
#include "commands.h"
-#include "land.h"
+#include "map.h"
#include "nuke.h"
#include "plane.h"
-#include "ship.h"
-static int tran_pmap(coord curx, coord cury, char *arg);
-static int tran_nmap(coord curx, coord cury, char *arg);
+static int tran_pmap(coord, coord, char *, char *);
+static int tran_nmap(coord, coord, char *, char *);
static int tran_nuke(void);
static int tran_plane(void);
what = getstarg(player->argp[1], "transport what (nuke or plane): ",
buf);
- if (what == 0)
+ if (!what)
return RET_SYN;
if (*what == 'n')
return tran_nuke();
else
pr("No mobility used\n");
getsect(srcx, srcy, §);
- sect.sct_mobil -= mcost;
- if (sect.sct_mobil < 0)
+ if (sect.sct_mobil >= mcost)
+ sect.sct_mobil -= mcost;
+ else
sect.sct_mobil = 0;
putsect(§);
return RET_OK;
continue;
type = plane.pln_type;
if (plane.pln_ship >= 0) {
- pr("%s is at sea and can't be transported\n", prplane(&plane));
+ pr("%s is stowed on ship #%d, and can't be transported\n",
+ prplane(&plane), plane.pln_ship);
+ return RET_FAIL;
+ } else if (plane.pln_land >= 0) {
+ pr("%s is stowed on land #%d, and can't be transported\n",
+ prplane(&plane), plane.pln_land);
return RET_FAIL;
} else if (plane.pln_harden != 0) {
pr("%s has been hardened and can't be transported\n",
else
pr("No mobility used\n");
getsect(srcx, srcy, §);
- sect.sct_mobil -= mcost;
- if (sect.sct_mobil < 0)
+ if (sect.sct_mobil >= mcost)
+ sect.sct_mobil -= mcost;
+ else
sect.sct_mobil = 0;
putsect(§);
return RET_OK;
*/
/*ARGSUSED*/
static int
-tran_pmap(coord curx, coord cury, char *arg)
+tran_pmap(coord curx, coord cury, char *arg1, char *arg2)
{
- return display_region_map(0, EF_PLANE, curx, cury, arg);
+ return display_region_map(0, EF_PLANE, curx, cury, arg1, arg2);
}
static int
-tran_nmap(coord curx, coord cury, char *arg)
+tran_nmap(coord curx, coord cury, char *arg1, char *arg2)
{
- return display_region_map(0, EF_NUKE, curx, cury, arg);
+ return display_region_map(0, EF_NUKE, curx, cury, arg1, arg2);
}
-