/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* desi.c: Redesignate sectors
- *
+ *
* Known contributors to this file:
* Steve McClure, 1998-2000
- * Markus Armbruster, 2004-2008
+ * Markus Armbruster, 2004-2009
*/
#include <config.h>
{
int n;
char *p;
- int cap_x;
- int cap_y;
int des;
struct nstr_sect nstr;
struct sctstr sect;
if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN;
natp = getnatp(player->cnum);
- cap_x = natp->nat_xcap;
- cap_y = natp->nat_ycap;
while (nxtsct(&nstr, §)) {
if (!player->owner)
continue;
sprintf(prompt, "%s %d%% %s desig? ",
xyas(sect.sct_x, sect.sct_y, player->cnum),
sect.sct_effic, dchr[sect.sct_type].d_name);
- if ((p = getstarg(player->argp[2], prompt, buf)) == 0) {
+ if (!(p = getstarg(player->argp[2], prompt, buf))) {
rc = RET_FAIL;
break;
}
rc = RET_FAIL;
break;
}
+ if (dchr[des].d_terrain != dchr[sect.sct_type].d_terrain) {
+ pr("You can't change a %s into a %s\n",
+ dchr[sect.sct_type].d_name, dchr[des].d_name);
+ continue;
+ }
}
if (sect.sct_type == des && sect.sct_newtype == des)
continue;
}
sect.sct_newtype = des;
putsect(§);
- if (sect.sct_x == cap_x && sect.sct_y == cap_y
+ if (!player->god
+ && sect.sct_x == natp->nat_xcap && sect.sct_y == natp->nat_ycap
&& des != SCT_CAPIT && des != SCT_SANCT && des != SCT_MOUNT)
pr("You have redesignated your capital!\n");
if (opt_EASY_BRIDGES == 0) { /* may cause a bridge fall */