*
* Known contributors to this file:
* Steve McClure, 1998-2000
- * Markus Armbruster, 2004-2008
+ * Markus Armbruster, 2004-2009
*/
#include <config.h>
p = getstarg(player->argp[1],
"Build (ship, nuke, bridge, plane, land unit, tower)? ",
buf);
- if (p == 0)
+ if (!p)
return RET_SYN;
what = *p;
switch (what) {
case 'p':
p = getstarg(player->argp[3], "Plane type? ", buf);
- if (p == 0 || *p == 0)
+ if (!p || !*p)
return RET_SYN;
type = ef_elt_byname(EF_PLANE_CHR, p);
if (type >= 0) {
break;
case 's':
p = getstarg(player->argp[3], "Ship type? ", buf);
- if (p == 0 || *p == 0)
+ if (!p || !*p)
return RET_SYN;
type = ef_elt_byname(EF_SHIP_CHR, p);
if (type >= 0) {
break;
case 'l':
p = getstarg(player->argp[3], "Land unit type? ", buf);
- if (p == 0 || *p == 0)
+ if (!p || !*p)
return RET_SYN;
type = ef_elt_byname(EF_LAND_CHR, p);
if (type >= 0) {
return RET_FAIL;
}
p = getstarg(player->argp[3], "Nuke type? ", buf);
- if (p == 0 || *p == 0)
+ if (!p || !*p)
return RET_SYN;
type = ef_elt_byname(EF_NUKE_CHR, p);
if (type >= 0) {
"Are you sure that you want to build %s of them? ",
player->argp[4]);
p = getstarg(player->argp[6], bstr, buf);
- if (p == 0 || *p != 'y')
+ if (!p || *p != 'y')
return RET_SYN;
}
}
} else {
land.lnd_mobil = 0;
}
- land.lnd_flags = 0;
land.lnd_ship = -1;
land.lnd_land = -1;
land.lnd_harden = 0;
if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
pr("'%c' is not a valid direction...\n", *p);
- direrr(0, 0, 0);
+ direrr(NULL, NULL, NULL);
return 0;
}
newx = sp->sct_x + diroff[val][0];
nuke.nuk_own = sp->sct_own;
nuke.nuk_type = np - nchr;
nuke.nuk_effic = 100;
- nuke.nuk_ship = nuke.nuk_plane = nuke.nuk_land = -1;
+ nuke.nuk_plane = -1;
nuke.nuk_tech = tlev;
unit_wipe_orders((struct empobj *)&nuke);
int avail;
char *p;
char buf[1024];
- int good;
int i;
int nx;
int ny;
if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
pr("'%c' is not a valid direction...\n", *p);
- direrr(0, 0, 0);
+ direrr(NULL, NULL, NULL);
return 0;
}
newx = sp->sct_x + diroff[val][0];
/* Now, check. You aren't allowed to build bridge towers
next to land. */
- good = 0;
for (i = 1; i <= 6; i++) {
struct sctstr s2;
nx = sect.sct_x + diroff[i][0];
getsect(nx, ny, &s2);
if ((s2.sct_type != SCT_WATER) &&
(s2.sct_type != SCT_BTOWER) && (s2.sct_type != SCT_BSPAN)) {
- good = 1;
- break;
+ pr("Bridge towers cannot be built adjacent to land.\n");
+ pr("That sector is adjacent to land.\n");
+ return 0;
}
}
- if (good) {
- pr("Bridge towers cannot be built adjacent to land.\n");
- pr("That sector is adjacent to land.\n");
- return 0;
- }
sp->sct_avail -= avail;
player->dolcost += buil_tower_bc;