*
* 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;
}
}
int avail;
char *p;
char buf[1024];
- int good;
int i;
int nx;
int ny;
/* 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;