Don't use 0 as null pointer constant, part 3
This part replaces E == 0 by !E, where E has pointer type.
This commit is contained in:
parent
90f8f2b099
commit
6ae4eca045
79 changed files with 121 additions and 121 deletions
|
@ -49,7 +49,7 @@ acce(void)
|
||||||
natid cn;
|
natid cn;
|
||||||
natid as;
|
natid as;
|
||||||
|
|
||||||
if (player->argp[1] == 0) {
|
if (!player->argp[1]) {
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
} else {
|
} else {
|
||||||
if (!(natp = natargp(player->argp[1], NULL)))
|
if (!(natp = natargp(player->argp[1], NULL)))
|
||||||
|
@ -64,7 +64,7 @@ acce(void)
|
||||||
for (cn = 0; cn < MAXNOC; cn++) {
|
for (cn = 0; cn < MAXNOC; cn++) {
|
||||||
if (cn == as)
|
if (cn == as)
|
||||||
continue;
|
continue;
|
||||||
if ((np = getnatp(cn)) == 0)
|
if (!(np = getnatp(cn)))
|
||||||
break;
|
break;
|
||||||
if (np->nat_stat == STAT_UNUSED)
|
if (np->nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -69,7 +69,7 @@ add(void)
|
||||||
else
|
else
|
||||||
strcpy(prompt, "New country number? (they all seem to be used) ");
|
strcpy(prompt, "New country number? (they all seem to be used) ");
|
||||||
p = getstarg(player->argp[1], prompt, buf);
|
p = getstarg(player->argp[1], prompt, buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
i = atoi(p);
|
i = atoi(p);
|
||||||
if (i >= MAXNOC) {
|
if (i >= MAXNOC) {
|
||||||
|
@ -83,13 +83,13 @@ add(void)
|
||||||
}
|
}
|
||||||
natp = getnatp(coun);
|
natp = getnatp(coun);
|
||||||
p = getstarg(player->argp[2], "Country Name? ", buf);
|
p = getstarg(player->argp[2], "Country Name? ", buf);
|
||||||
if (p ==0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!check_nat_name(p))
|
if (!check_nat_name(p))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
strcpy(cntryname, p);
|
strcpy(cntryname, p);
|
||||||
p = getstarg(player->argp[3], "Representative? ", buf);
|
p = getstarg(player->argp[3], "Representative? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (strlen(p) >= sizeof(pname)) {
|
if (strlen(p) >= sizeof(pname)) {
|
||||||
pr("Representative too long\n");
|
pr("Representative too long\n");
|
||||||
|
@ -98,7 +98,7 @@ add(void)
|
||||||
strcpy(pname, p);
|
strcpy(pname, p);
|
||||||
p = getstarg(player->argp[4],
|
p = getstarg(player->argp[4],
|
||||||
"Status? (visitor, new, active, god, delete) ", buf);
|
"Status? (visitor, new, active, god, delete) ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 'v':
|
case 'v':
|
||||||
|
@ -122,7 +122,7 @@ add(void)
|
||||||
}
|
}
|
||||||
p = getstarg(player->argp[5],
|
p = getstarg(player->argp[5],
|
||||||
"Check, wipe, or ignore existing sectors (c|w|i) ", buf);
|
"Check, wipe, or ignore existing sectors (c|w|i) ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
snxtitem_all(&ni, EF_LAND);
|
snxtitem_all(&ni, EF_LAND);
|
||||||
while (nxtitem(&ni, &land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ army(void)
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
cp = getstarg(player->argp[1], "army? ", buf);
|
cp = getstarg(player->argp[1], "army? ", buf);
|
||||||
if (cp == 0)
|
if (!cp)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
c = *cp;
|
c = *cp;
|
||||||
if (!isalpha(c) && c != '~') {
|
if (!isalpha(c) && c != '~') {
|
||||||
|
|
|
@ -58,7 +58,7 @@ bdes(void)
|
||||||
sprintf(prompt, "%s '%c' desig? ",
|
sprintf(prompt, "%s '%c' desig? ",
|
||||||
xyas(nstr.x, nstr.y, player->cnum),
|
xyas(nstr.x, nstr.y, player->cnum),
|
||||||
d ? d : ' ');
|
d ? d : ' ');
|
||||||
if ((p = getstarg(player->argp[2], prompt, buf)) == 0) {
|
if (!(p = getstarg(player->argp[2], prompt, buf))) {
|
||||||
rc = RET_FAIL;
|
rc = RET_FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,13 +108,13 @@ bomb(void)
|
||||||
if (!p || !*p)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
mission = *p;
|
mission = *p;
|
||||||
if (strchr("ps", mission) == 0)
|
if (!strchr("ps", mission))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!get_assembly_point(player->argp[4], &ap_sect, buf))
|
if (!get_assembly_point(player->argp[4], &ap_sect, buf))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
ay = ap_sect.sct_y;
|
||||||
if (getpath(flightpath, player->argp[5], ax, ay, 0, 0, P_FLYING) == 0
|
if (!getpath(flightpath, player->argp[5], ax, ay, 0, 0, P_FLYING)
|
||||||
|| *flightpath == 0)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
@ -492,7 +492,7 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
|
||||||
prplane(&plp->plane), plp->bombs);
|
prplane(&plp->plane), plp->bombs);
|
||||||
shipno = -1;
|
shipno = -1;
|
||||||
while (shipno < 0) {
|
while (shipno < 0) {
|
||||||
if ((q = getstring(prompt, buf)) == 0)
|
if (!(q = getstring(prompt, buf)))
|
||||||
goto out;
|
goto out;
|
||||||
if (*q == 0)
|
if (*q == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -615,7 +615,7 @@ plane_bomb(struct emp_qelem *list, struct sctstr *target)
|
||||||
prplane(&plp->plane), plp->bombs);
|
prplane(&plp->plane), plp->bombs);
|
||||||
planeno = -1;
|
planeno = -1;
|
||||||
while (planeno < 0) {
|
while (planeno < 0) {
|
||||||
if ((q = getstring(prompt, buf)) == 0)
|
if (!(q = getstring(prompt, buf)))
|
||||||
return;
|
return;
|
||||||
if (*q == 0)
|
if (*q == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -721,7 +721,7 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
|
||||||
prplane(&plp->plane), plp->bombs);
|
prplane(&plp->plane), plp->bombs);
|
||||||
unitno = -1;
|
unitno = -1;
|
||||||
while (unitno < 0) {
|
while (unitno < 0) {
|
||||||
if ((q = getstring(prompt, buf)) == 0)
|
if (!(q = getstring(prompt, buf)))
|
||||||
return;
|
return;
|
||||||
if (*q == 0)
|
if (*q == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -89,7 +89,7 @@ buil(void)
|
||||||
p = getstarg(player->argp[1],
|
p = getstarg(player->argp[1],
|
||||||
"Build (ship, nuke, bridge, plane, land unit, tower)? ",
|
"Build (ship, nuke, bridge, plane, land unit, tower)? ",
|
||||||
buf);
|
buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
what = *p;
|
what = *p;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ buil(void)
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case 'p':
|
case 'p':
|
||||||
p = getstarg(player->argp[3], "Plane type? ", buf);
|
p = getstarg(player->argp[3], "Plane type? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = ef_elt_byname(EF_PLANE_CHR, p);
|
type = ef_elt_byname(EF_PLANE_CHR, p);
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
|
@ -121,7 +121,7 @@ buil(void)
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
p = getstarg(player->argp[3], "Ship type? ", buf);
|
p = getstarg(player->argp[3], "Ship type? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = ef_elt_byname(EF_SHIP_CHR, p);
|
type = ef_elt_byname(EF_SHIP_CHR, p);
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
|
@ -141,7 +141,7 @@ buil(void)
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
p = getstarg(player->argp[3], "Land unit type? ", buf);
|
p = getstarg(player->argp[3], "Land unit type? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = ef_elt_byname(EF_LAND_CHR, p);
|
type = ef_elt_byname(EF_LAND_CHR, p);
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
|
@ -182,7 +182,7 @@ buil(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
p = getstarg(player->argp[3], "Nuke type? ", buf);
|
p = getstarg(player->argp[3], "Nuke type? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = ef_elt_byname(EF_NUKE_CHR, p);
|
type = ef_elt_byname(EF_NUKE_CHR, p);
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
|
@ -219,7 +219,7 @@ buil(void)
|
||||||
"Are you sure that you want to build %s of them? ",
|
"Are you sure that you want to build %s of them? ",
|
||||||
player->argp[4]);
|
player->argp[4]);
|
||||||
p = getstarg(player->argp[6], bstr, buf);
|
p = getstarg(player->argp[6], bstr, buf);
|
||||||
if (p == 0 || *p != 'y')
|
if (!p || *p != 'y')
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ buy(void)
|
||||||
display_mark(ip->i_uid, 0);
|
display_mark(ip->i_uid, 0);
|
||||||
pr("\n");
|
pr("\n");
|
||||||
p = getstarg(player->argp[2], "Which lot are you bidding on: ", buf);
|
p = getstarg(player->argp[2], "Which lot are you bidding on: ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (*p == 0)
|
if (*p == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
@ -100,7 +100,7 @@ buy(void)
|
||||||
pr("You can't bid on your own lot.\n");
|
pr("You can't bid on your own lot.\n");
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
if ((p = getstarg(player->argp[3], "How much per unit: ", buf)) == 0)
|
if (!(p = getstarg(player->argp[3], "How much per unit: ", buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
bid = atof(p);
|
bid = atof(p);
|
||||||
if (bid <= 0)
|
if (bid <= 0)
|
||||||
|
|
|
@ -78,7 +78,7 @@ cede(void)
|
||||||
|
|
||||||
p = getstarg(player->argp[3], "Cede sectors or ships (se, sh)? ",
|
p = getstarg(player->argp[3], "Cede sectors or ships (se, sh)? ",
|
||||||
buf);
|
buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (strlen(p) > 4)
|
if (strlen(p) > 4)
|
||||||
p[2] = 0;
|
p[2] = 0;
|
||||||
|
|
|
@ -47,7 +47,7 @@ chan(void)
|
||||||
struct natstr *us;
|
struct natstr *us;
|
||||||
|
|
||||||
p = getstarg(player->argp[1], "country name or representative? ", buf);
|
p = getstarg(player->argp[1], "country name or representative? ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
us = getnatp(player->cnum);
|
us = getnatp(player->cnum);
|
||||||
if (us->nat_stat == STAT_VIS) {
|
if (us->nat_stat == STAT_VIS) {
|
||||||
|
@ -76,7 +76,7 @@ chan(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p = getstarg(player->argp[2], "New country name -- ", buf);
|
p = getstarg(player->argp[2], "New country name -- ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!check_nat_name(p))
|
if (!check_nat_name(p))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
@ -90,7 +90,7 @@ chan(void)
|
||||||
case 'r':
|
case 'r':
|
||||||
pr("(note: these are stored in plain text.)\n");
|
pr("(note: these are stored in plain text.)\n");
|
||||||
p = getstarg(player->argp[2], "New representative name -- ", buf);
|
p = getstarg(player->argp[2], "New representative name -- ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
p[sizeof(us->nat_pnam) - 1] = 0;
|
p[sizeof(us->nat_pnam) - 1] = 0;
|
||||||
strcpy(us->nat_pnam, p);
|
strcpy(us->nat_pnam, p);
|
||||||
|
|
|
@ -119,7 +119,7 @@ coas(void)
|
||||||
continue;
|
continue;
|
||||||
y = ynorm(sect.sct_y + k);
|
y = ynorm(sect.sct_y + k);
|
||||||
n = scthash(x, y, TSIZE);
|
n = scthash(x, y, TSIZE);
|
||||||
if (list[n] == 0)
|
if (!list[n])
|
||||||
continue;
|
continue;
|
||||||
nship -= showship(&list[n], x, y);
|
nship -= showship(&list[n], x, y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ cons_choose(struct ltcomstr *ltcp)
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
memset(ltcp, 0, sizeof(*ltcp));
|
memset(ltcp, 0, sizeof(*ltcp));
|
||||||
if (getstarg(player->argp[1], "loan or treaty? ", buf) == 0)
|
if (!getstarg(player->argp[1], "loan or treaty? ", buf))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ltcp->type = ef_byname_from(buf, lon_or_trt);
|
ltcp->type = ef_byname_from(buf, lon_or_trt);
|
||||||
switch (ltcp->type) {
|
switch (ltcp->type) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ deli(void)
|
||||||
char prompt[128];
|
char prompt[128];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if ((ich = whatitem(player->argp[1], "deliver what? ")) == 0)
|
if (!(ich = whatitem(player->argp[1], "deliver what? ")))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!snxtsct(&nstr, player->argp[2]))
|
if (!snxtsct(&nstr, player->argp[2]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
|
@ -64,7 +64,7 @@ desi(void)
|
||||||
sprintf(prompt, "%s %d%% %s desig? ",
|
sprintf(prompt, "%s %d%% %s desig? ",
|
||||||
xyas(sect.sct_x, sect.sct_y, player->cnum),
|
xyas(sect.sct_x, sect.sct_y, player->cnum),
|
||||||
sect.sct_effic, dchr[sect.sct_type].d_name);
|
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;
|
rc = RET_FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,14 +64,14 @@ drop(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
ay = ap_sect.sct_y;
|
||||||
if (getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING) == 0
|
if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING)
|
||||||
|| *flightpath == 0)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
ty = ay;
|
ty = ay;
|
||||||
(void)pathtoxy(flightpath, &tx, &ty, fcost);
|
(void)pathtoxy(flightpath, &tx, &ty, fcost);
|
||||||
pr("target is %s\n", xyas(tx, ty, player->cnum));
|
pr("target is %s\n", xyas(tx, ty, player->cnum));
|
||||||
if ((ip = whatitem(player->argp[5], "Drop off what? ")) == 0)
|
if (!(ip = whatitem(player->argp[5], "Drop off what? ")))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
getsect(tx, ty, &target);
|
getsect(tx, ty, &target);
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ edit(void)
|
||||||
what = getstarg(player->argp[1],
|
what = getstarg(player->argp[1],
|
||||||
"Edit What (country, land, ship, plane, nuke, unit)? ",
|
"Edit What (country, land, ship, plane, nuke, unit)? ",
|
||||||
buf);
|
buf);
|
||||||
if (what == 0)
|
if (!what)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ewhat = what[0];
|
ewhat = what[0];
|
||||||
switch (ewhat) {
|
switch (ewhat) {
|
||||||
|
@ -130,7 +130,7 @@ edit(void)
|
||||||
pr("huh?\n");
|
pr("huh?\n");
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
if (player->argp[3] == 0) {
|
if (!player->argp[3]) {
|
||||||
switch (ewhat) {
|
switch (ewhat) {
|
||||||
case 'l':
|
case 'l':
|
||||||
prsect(§);
|
prsect(§);
|
||||||
|
@ -374,7 +374,7 @@ pr_ship(struct shpstr *ship)
|
||||||
{
|
{
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
|
|
||||||
if ((natp = getnatp(ship->shp_own)) == 0)
|
if (!(natp = getnatp(ship->shp_own)))
|
||||||
return;
|
return;
|
||||||
pr("%s (#%d) %s\n", natp->nat_cnam, ship->shp_own, prship(ship));
|
pr("%s (#%d) %s\n", natp->nat_cnam, ship->shp_own, prship(ship));
|
||||||
pr("UID <U>: %d\n", ship->shp_uid);
|
pr("UID <U>: %d\n", ship->shp_uid);
|
||||||
|
|
|
@ -60,7 +60,7 @@ enli(void)
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
newmil = 500;
|
newmil = 500;
|
||||||
sprintf(prompt, "Number to enlist (max %d) : ", newmil);
|
sprintf(prompt, "Number to enlist (max %d) : ", newmil);
|
||||||
if ((p = getstarg(player->argp[2], prompt, buf)) == 0)
|
if (!(p = getstarg(player->argp[2], prompt, buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if ((milwant = atoi(p)) > newmil)
|
if ((milwant = atoi(p)) > newmil)
|
||||||
milwant = newmil;
|
milwant = newmil;
|
||||||
|
|
|
@ -75,7 +75,7 @@ explore(void)
|
||||||
pr("You can only explore with civs and mil.\n");
|
pr("You can only explore with civs and mil.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if ((p = getstarg(player->argp[2], "from sector : ", buf)) == 0)
|
if (!(p = getstarg(player->argp[2], "from sector : ", buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!sarg_xy(p, &x, &y))
|
if (!sarg_xy(p, &x, &y))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
|
@ -50,7 +50,7 @@ flee(void)
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
cp = getstarg(player->argp[1], "fleet? ", buf);
|
cp = getstarg(player->argp[1], "fleet? ", buf);
|
||||||
if (cp == 0)
|
if (!cp)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
c = *cp;
|
c = *cp;
|
||||||
if (!isalpha(c) && c != '~') {
|
if (!isalpha(c) && c != '~') {
|
||||||
|
|
|
@ -66,7 +66,7 @@ fly(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
ay = ap_sect.sct_y;
|
||||||
if (getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING) == 0
|
if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING)
|
||||||
|| *flightpath == 0)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
|
|
@ -54,7 +54,7 @@ foll(void)
|
||||||
if (!snxtitem(&nstr, EF_SHIP, player->argp[1], NULL))
|
if (!snxtitem(&nstr, EF_SHIP, player->argp[1], NULL))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
cp = getstarg(player->argp[2], "leader? ", buf);
|
cp = getstarg(player->argp[2], "leader? ", buf);
|
||||||
if (cp == 0)
|
if (!cp)
|
||||||
cp = "";
|
cp = "";
|
||||||
good = sscanf(cp, "%d", &leader);
|
good = sscanf(cp, "%d", &leader);
|
||||||
if (!good)
|
if (!good)
|
||||||
|
|
|
@ -50,7 +50,7 @@ fort(void)
|
||||||
if (!snxtitem(&ni, EF_LAND, player->argp[1], NULL))
|
if (!snxtitem(&ni, EF_LAND, player->argp[1], NULL))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
p = getstarg(player->argp[2], "Amount: ", buf);
|
p = getstarg(player->argp[2], "Amount: ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
fort_amt = atoi(p);
|
fort_amt = atoi(p);
|
||||||
if (fort_amt > land_mob_max)
|
if (fort_amt > land_mob_max)
|
||||||
|
|
|
@ -59,7 +59,7 @@ give(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtsct(&nstr, §) > 0) {
|
while (nxtsct(&nstr, §) > 0) {
|
||||||
p = getstarg(player->argp[3], "how much : ", buf);
|
p = getstarg(player->argp[3], "how much : ", buf);
|
||||||
if (p == 0 || *p == '\0')
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if ((amt = atoi(p)) == 0)
|
if ((amt = atoi(p)) == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
|
@ -56,7 +56,7 @@ grin(void)
|
||||||
}
|
}
|
||||||
pp = &pchr[prd];
|
pp = &pchr[prd];
|
||||||
|
|
||||||
if ((p = getstarg(player->argp[1], "Sectors? ", buf)) == 0)
|
if (!(p = getstarg(player->argp[1], "Sectors? ", buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!snxtsct(&nstr, p))
|
if (!snxtsct(&nstr, p))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
|
@ -94,7 +94,7 @@ info(void)
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
/* may be a "partial" request. */
|
/* may be a "partial" request. */
|
||||||
info_dp = opendir(infodir);
|
info_dp = opendir(infodir);
|
||||||
if (info_dp == 0) {
|
if (!info_dp) {
|
||||||
pr("Can't open info dir\n");
|
pr("Can't open info dir\n");
|
||||||
logerror("Can't open info dir \"%s\"\n", infodir);
|
logerror("Can't open info dir \"%s\"\n", infodir);
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
@ -174,7 +174,7 @@ apro(void)
|
||||||
int lhitlim;
|
int lhitlim;
|
||||||
struct stat statb;
|
struct stat statb;
|
||||||
|
|
||||||
if (player->argp[1] == 0 || !*player->argp[1]) {
|
if (!player->argp[1] || !*player->argp[1]) {
|
||||||
pr("Apropos what?\n");
|
pr("Apropos what?\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,7 +363,7 @@ launch_sat(struct plnstr *pp, int sublaunch)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
p = getstring("Geostationary orbit? ", buf);
|
p = getstring("Geostationary orbit? ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!check_plane_ok(pp))
|
if (!check_plane_ok(pp))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
|
@ -64,7 +64,7 @@ mission(void)
|
||||||
|
|
||||||
p = getstarg(player->argp[1], "Ship, plane or land unit (p,sh,la)? ",
|
p = getstarg(player->argp[1], "Ship, plane or land unit (p,sh,la)? ",
|
||||||
buf);
|
buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = ef_byname_from(p, ef_with_missions);
|
type = ef_byname_from(p, ef_with_missions);
|
||||||
if (type < 0) {
|
if (type < 0) {
|
||||||
|
@ -77,7 +77,7 @@ mission(void)
|
||||||
p = getstarg(player->argp[3],
|
p = getstarg(player->argp[3],
|
||||||
"Mission (int, sup, osup, dsup, esc, res, air, query, clear)? ",
|
"Mission (int, sup, osup, dsup, esc, res, air, query, clear)? ",
|
||||||
buf);
|
buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -72,7 +72,7 @@ move(void)
|
||||||
|
|
||||||
|
|
||||||
istest = *player->argp[0] == 't';
|
istest = *player->argp[0] == 't';
|
||||||
if ((ip = whatitem(player->argp[1], "move what? ")) == 0)
|
if (!(ip = whatitem(player->argp[1], "move what? ")))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
vtype = ip->i_uid;
|
vtype = ip->i_uid;
|
||||||
if (!(p = getstarg(player->argp[2], "from sector : ", buf)))
|
if (!(p = getstarg(player->argp[2], "from sector : ", buf)))
|
||||||
|
|
|
@ -57,7 +57,7 @@ name(void)
|
||||||
p = getstarg(player->argp[2], "Name? ", buf);
|
p = getstarg(player->argp[2], "Name? ", buf);
|
||||||
if (!check_ship_ok(&ship))
|
if (!check_ship_ok(&ship))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!strcmp(p, "~")) {
|
if (!strcmp(p, "~")) {
|
||||||
ship.shp_name[0] = 0;
|
ship.shp_name[0] = 0;
|
||||||
|
|
|
@ -66,7 +66,7 @@ new(void)
|
||||||
pr("Country #%d (%s) isn't a new country!\n", num, cname(num));
|
pr("Country #%d (%s) isn't a new country!\n", num, cname(num));
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
if ((p = getstarg(player->argp[2], "sanctuary pair : ", buf)) == 0)
|
if (!(p = getstarg(player->argp[2], "sanctuary pair : ", buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!sarg_xy(p, &x, &y) || !getsect(x, y, §))
|
if (!sarg_xy(p, &x, &y) || !getsect(x, y, §))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
|
@ -102,7 +102,7 @@ do_treaty(void)
|
||||||
theircond = 0;
|
theircond = 0;
|
||||||
for (tfp = treaty_flags; tfp && tfp->name; tfp++) {
|
for (tfp = treaty_flags; tfp && tfp->name; tfp++) {
|
||||||
sprintf(prompt, "%s? ", tfp->name);
|
sprintf(prompt, "%s? ", tfp->name);
|
||||||
if ((cp = getstring(prompt, buf)) == 0)
|
if (!(cp = getstring(prompt, buf)))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (*cp == 'y')
|
if (*cp == 'y')
|
||||||
theircond |= tfp->value;
|
theircond |= tfp->value;
|
||||||
|
@ -111,7 +111,7 @@ do_treaty(void)
|
||||||
ourcond = 0;
|
ourcond = 0;
|
||||||
for (tfp = treaty_flags; tfp && tfp->name; tfp++) {
|
for (tfp = treaty_flags; tfp && tfp->name; tfp++) {
|
||||||
sprintf(prompt, "%s? ", tfp->name);
|
sprintf(prompt, "%s? ", tfp->name);
|
||||||
if ((cp = getstring(prompt, buf)) == 0)
|
if (!(cp = getstring(prompt, buf)))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (*cp == 'y')
|
if (*cp == 'y')
|
||||||
ourcond |= tfp->value;
|
ourcond |= tfp->value;
|
||||||
|
@ -121,7 +121,7 @@ do_treaty(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
cp = getstring("Proposed treaty duration? (days) ", buf);
|
cp = getstring("Proposed treaty duration? (days) ", buf);
|
||||||
if (cp == 0)
|
if (!cp)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
j = atoi(cp);
|
j = atoi(cp);
|
||||||
if (j <= 0) {
|
if (j <= 0) {
|
||||||
|
|
|
@ -184,7 +184,7 @@ orde(void)
|
||||||
sub = atoi(player->argp[3]);
|
sub = atoi(player->argp[3]);
|
||||||
else {
|
else {
|
||||||
sprintf(buf1, "Field (1-%d) ", TMAX);
|
sprintf(buf1, "Field (1-%d) ", TMAX);
|
||||||
if (getstarg(player->argp[3], buf1, buf) == 0)
|
if (!getstarg(player->argp[3], buf1, buf))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
sub = atoi(buf);
|
sub = atoi(buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ para(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
ay = ap_sect.sct_y;
|
||||||
if (getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING) == 0
|
if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING)
|
||||||
|| *flightpath == 0)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
|
|
@ -67,7 +67,7 @@ radar(short type)
|
||||||
sprintf(prompt, "Radar from (%s # or sector(s)) : ", ef_nameof(type));
|
sprintf(prompt, "Radar from (%s # or sector(s)) : ", ef_nameof(type));
|
||||||
cp = getstarg(player->argp[1], prompt, buf);
|
cp = getstarg(player->argp[1], prompt, buf);
|
||||||
|
|
||||||
if (cp == 0)
|
if (!cp)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
switch (sarg_type(cp)) {
|
switch (sarg_type(cp)) {
|
||||||
case NS_AREA:
|
case NS_AREA:
|
||||||
|
|
|
@ -103,7 +103,7 @@ rea(void)
|
||||||
clear_telegram_is_new(player->cnum);
|
clear_telegram_is_new(player->cnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((telfp = fopen(mbox, "rb+")) == 0) {
|
if (!(telfp = fopen(mbox, "rb+"))) {
|
||||||
logerror("telegram file %s", mbox);
|
logerror("telegram file %s", mbox);
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ real(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player->argp[2] == 0) {
|
if (!player->argp[2]) {
|
||||||
while (curr <= lastr) {
|
while (curr <= lastr) {
|
||||||
list_realm(curr, natp);
|
list_realm(curr, natp);
|
||||||
curr++;
|
curr++;
|
||||||
|
|
|
@ -62,7 +62,7 @@ reco(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
ay = ap_sect.sct_y;
|
||||||
if (getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING) == 0
|
if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING)
|
||||||
|| *flightpath == 0)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
|
|
@ -46,7 +46,7 @@ reje(void)
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if ((p = getstarg(player->argp[1], "reject or accept? ", buf)) == 0)
|
if (!(p = getstarg(player->argp[1], "reject or accept? ", buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 'r':
|
case 'r':
|
||||||
|
@ -61,7 +61,7 @@ reje(void)
|
||||||
}
|
}
|
||||||
p = getstarg(player->argp[2],
|
p = getstarg(player->argp[2],
|
||||||
"mail, treaties, loans, or announcements? ", buf);
|
"mail, treaties, loans, or announcements? ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 'a':
|
case 'a':
|
||||||
|
|
|
@ -50,7 +50,7 @@ rela(void)
|
||||||
natid as;
|
natid as;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (player->argp[1] == 0)
|
if (!player->argp[1])
|
||||||
as = player->cnum;
|
as = player->cnum;
|
||||||
else {
|
else {
|
||||||
if ((n = natarg(player->argp[1], NULL)) < 0)
|
if ((n = natarg(player->argp[1], NULL)) < 0)
|
||||||
|
@ -63,7 +63,7 @@ rela(void)
|
||||||
pr("\n Formal Relations %5s theirs\n",
|
pr("\n Formal Relations %5s theirs\n",
|
||||||
player->cnum == as ? "yours" : "his");
|
player->cnum == as ? "yours" : "his");
|
||||||
for (cn = 1; cn < MAXNOC; cn++) {
|
for (cn = 1; cn < MAXNOC; cn++) {
|
||||||
if ((np = getnatp(cn)) == 0)
|
if (!(np = getnatp(cn)))
|
||||||
break;
|
break;
|
||||||
if (cn == as)
|
if (cn == as)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -58,7 +58,7 @@ repa(void)
|
||||||
}
|
}
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
cp = getstarg(player->argp[1], "Repay loan #? ", buf);
|
cp = getstarg(player->argp[1], "Repay loan #? ", buf);
|
||||||
if (cp == 0)
|
if (!cp)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
loan_num = atoi(cp);
|
loan_num = atoi(cp);
|
||||||
if (loan_num < 0)
|
if (loan_num < 0)
|
||||||
|
@ -68,7 +68,7 @@ repa(void)
|
||||||
pr("You don't owe anything on that loan.\n");
|
pr("You don't owe anything on that loan.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if ((cp = getstarg(player->argp[2], "amount? ", buf)) == 0)
|
if (!(cp = getstarg(player->argp[2], "amount? ", buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!check_loan_ok(&loan))
|
if (!check_loan_ok(&loan))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
|
@ -87,7 +87,7 @@ rese(void)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
if (player->god) {
|
if (player->god) {
|
||||||
if ((p = getstring("Really destroy that lot? ", buf)) == 0)
|
if (!(p = getstring("Really destroy that lot? ", buf)))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!check_comm_ok(&comm))
|
if (!check_comm_ok(&comm))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
|
@ -61,7 +61,7 @@ rout(void)
|
||||||
static char **map = NULL;
|
static char **map = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((ip = whatitem(player->argp[1], "What item? ")) == 0)
|
if (!(ip = whatitem(player->argp[1], "What item? ")))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
i_del = ip->i_uid;;
|
i_del = ip->i_uid;;
|
||||||
if (!snxtsct(&ns, player->argp[2]))
|
if (!snxtsct(&ns, player->argp[2]))
|
||||||
|
|
|
@ -73,7 +73,7 @@ scra(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
sprintf(prompt, "%s(s)? ", ef_nameof(type));
|
sprintf(prompt, "%s(s)? ", ef_nameof(type));
|
||||||
if ((p = getstarg(player->argp[2], prompt, buf)) == 0)
|
if (!(p = getstarg(player->argp[2], prompt, buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!snxtitem(&ni, type, p, NULL))
|
if (!snxtitem(&ni, type, p, NULL))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
|
@ -68,7 +68,7 @@ scut(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
sprintf(prompt, "%s(s)? ", ef_nameof(type));
|
sprintf(prompt, "%s(s)? ", ef_nameof(type));
|
||||||
if ((p = getstarg(player->argp[2], prompt, buf)) == 0)
|
if (!(p = getstarg(player->argp[2], prompt, buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!snxtitem(&ni, type, p, NULL))
|
if (!snxtitem(&ni, type, p, NULL))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
|
@ -73,7 +73,7 @@ set(void)
|
||||||
check_trade();
|
check_trade();
|
||||||
|
|
||||||
p = getstarg(player->argp[1], "Ship, plane, land unit or nuke? ", buf);
|
p = getstarg(player->argp[1], "Ship, plane, land unit or nuke? ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if ((type = ef_byname_from(p, ef_saleable)) < 0) {
|
if ((type = ef_byname_from(p, ef_saleable)) < 0) {
|
||||||
pr("You can sell only ships, planes, land units or nukes\n");
|
pr("You can sell only ships, planes, land units or nukes\n");
|
||||||
|
@ -92,7 +92,7 @@ set(void)
|
||||||
trade.trd_type = type;
|
trade.trd_type = type;
|
||||||
sprintf(prompt, "%s #%d; Price? ",
|
sprintf(prompt, "%s #%d; Price? ",
|
||||||
trade_nameof(&trade, &item), ni.cur);
|
trade_nameof(&trade, &item), ni.cur);
|
||||||
if ((p = getstarg(player->argp[3], prompt, buf)) == 0)
|
if (!(p = getstarg(player->argp[3], prompt, buf)))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!trade_check_item_ok(&item))
|
if (!trade_check_item_ok(&item))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
|
@ -53,7 +53,7 @@ setres(void)
|
||||||
what = getstarg(player->argp[1],
|
what = getstarg(player->argp[1],
|
||||||
"Set What (iron, gold, oil, uranium, fertility)? ",
|
"Set What (iron, gold, oil, uranium, fertility)? ",
|
||||||
buf);
|
buf);
|
||||||
if (what == 0)
|
if (!what)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
switch (what[0]) {
|
switch (what[0]) {
|
||||||
case 'i':
|
case 'i':
|
||||||
|
|
|
@ -57,7 +57,7 @@ setsector(void)
|
||||||
what = getstarg(player->argp[1],
|
what = getstarg(player->argp[1],
|
||||||
"Give What (iron, gold, oil, uranium, fertility, owner, eff., mob., work, avail., oldown, mines)? ",
|
"Give What (iron, gold, oil, uranium, fertility, owner, eff., mob., work, avail., oldown, mines)? ",
|
||||||
buf);
|
buf);
|
||||||
if (what == 0)
|
if (!what)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
char0 = what[0];
|
char0 = what[0];
|
||||||
char1 = what[1];
|
char1 = what[1];
|
||||||
|
|
|
@ -57,7 +57,7 @@ shark(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
p = getstarg(player->argp[1], "Transfer which loan #: ", buf);
|
p = getstarg(player->argp[1], "Transfer which loan #: ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (*p == 0)
|
if (*p == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
|
@ -57,14 +57,14 @@ shoo(void)
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
ip = whatitem(player->argp[1], "Shoot what <civ or uw> ");
|
ip = whatitem(player->argp[1], "Shoot what <civ or uw> ");
|
||||||
if (ip == 0 || (ip->i_uid != I_CIVIL && ip->i_uid != I_UW))
|
if (!ip || (ip->i_uid != I_CIVIL && ip->i_uid != I_UW))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
item = ip->i_uid;
|
item = ip->i_uid;
|
||||||
if (!snxtsct(&nstr, player->argp[2]))
|
if (!snxtsct(&nstr, player->argp[2]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
sprintf(prompt, "number of %s to shoot? ", ip->i_name);
|
sprintf(prompt, "number of %s to shoot? ", ip->i_name);
|
||||||
p = getstarg(player->argp[3], prompt, buf);
|
p = getstarg(player->argp[3], prompt, buf);
|
||||||
if (p == 0 || (targets = atoi(p)) <= 0)
|
if (!p || (targets = atoi(p)) <= 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtsct(&nstr, §)) {
|
while (nxtsct(&nstr, §)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
|
|
|
@ -111,7 +111,7 @@ skyw(void)
|
||||||
continue;
|
continue;
|
||||||
y = ynorm(sect.sct_y + k);
|
y = ynorm(sect.sct_y + k);
|
||||||
n = scthash(x, y, TSIZE);
|
n = scthash(x, y, TSIZE);
|
||||||
if (list[n] == 0)
|
if (!list[n])
|
||||||
continue;
|
continue;
|
||||||
nsat -= showsat(&list[n], x, y);
|
nsat -= showsat(&list[n], x, y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ start_stop(int off)
|
||||||
} else {
|
} else {
|
||||||
p = getstarg(player->argp[1],
|
p = getstarg(player->argp[1],
|
||||||
"Sector, ship, plane, land unit or nuke? ", buf);
|
"Sector, ship, plane, land unit or nuke? ", buf);
|
||||||
if (p == 0)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = ef_byname_from(p, sct_or_unit);
|
type = ef_byname_from(p, sct_or_unit);
|
||||||
if (type < 0) {
|
if (type < 0) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ terr(void)
|
||||||
sprintf(prompt, "%s %d%% %s territory? ",
|
sprintf(prompt, "%s %d%% %s territory? ",
|
||||||
xyas(nstr.x, nstr.y, player->cnum),
|
xyas(nstr.x, nstr.y, player->cnum),
|
||||||
sect.sct_effic, dchr[sect.sct_type].d_name);
|
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)))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (*p == 0)
|
if (*p == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -53,7 +53,7 @@ thre(void)
|
||||||
char prompt[128];
|
char prompt[128];
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
||||||
if ((ip = whatitem(player->argp[1], "What commodity? ")) == 0)
|
if (!(ip = whatitem(player->argp[1], "What commodity? ")))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!snxtsct(&nstr, player->argp[2]))
|
if (!snxtsct(&nstr, player->argp[2]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
@ -70,7 +70,7 @@ thre(void)
|
||||||
sprintf(prompt, "%s %s threshold? ",
|
sprintf(prompt, "%s %s threshold? ",
|
||||||
xyas(nstr.x, nstr.y, player->cnum),
|
xyas(nstr.x, nstr.y, player->cnum),
|
||||||
dchr[sect.sct_type].d_name);
|
dchr[sect.sct_type].d_name);
|
||||||
if ((p = getstarg(player->argp[3], prompt, buf)) == 0)
|
if (!(p = getstarg(player->argp[3], prompt, buf)))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!*p)
|
if (!*p)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -115,7 +115,7 @@ torp(void)
|
||||||
}
|
}
|
||||||
subno = sub.shp_uid;
|
subno = sub.shp_uid;
|
||||||
sprintf(prompt, "Ship %d, target? ", sub.shp_uid);
|
sprintf(prompt, "Ship %d, target? ", sub.shp_uid);
|
||||||
if ((ptr = getstarg(player->argp[2], prompt, buf)) == 0)
|
if (!(ptr = getstarg(player->argp[2], prompt, buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!check_ship_ok(&sub))
|
if (!check_ship_ok(&sub))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
|
@ -188,7 +188,7 @@ trad(void)
|
||||||
p = getstring("Destination sector: ", buf);
|
p = getstring("Destination sector: ", buf);
|
||||||
if (!trade_check_ok(&trade, &tg))
|
if (!trade_check_ok(&trade, &tg))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (p == 0) {
|
if (!p) {
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if (!sarg_xy(p, &sx, &sy) || !getsect(sx, sy, §)) {
|
if (!sarg_xy(p, &sx, &sy) || !getsect(sx, sy, §)) {
|
||||||
|
@ -217,7 +217,7 @@ trad(void)
|
||||||
p = getstring("Destination sector: ", buf);
|
p = getstring("Destination sector: ", buf);
|
||||||
if (!trade_check_ok(&trade, &tg))
|
if (!trade_check_ok(&trade, &tg))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (p == 0) {
|
if (!p) {
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if (!sarg_xy(p, &sx, &sy) || !getsect(sx, sy, §)) {
|
if (!sarg_xy(p, &sx, &sy) || !getsect(sx, sy, §)) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ tran(void)
|
||||||
|
|
||||||
what = getstarg(player->argp[1], "transport what (nuke or plane): ",
|
what = getstarg(player->argp[1], "transport what (nuke or plane): ",
|
||||||
buf);
|
buf);
|
||||||
if (what == 0)
|
if (!what)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (*what == 'n')
|
if (*what == 'n')
|
||||||
return tran_nuke();
|
return tran_nuke();
|
||||||
|
|
|
@ -55,7 +55,7 @@ work(void)
|
||||||
if (!snxtitem(&ni, EF_LAND, player->argp[1], NULL))
|
if (!snxtitem(&ni, EF_LAND, player->argp[1], NULL))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
p = getstarg(player->argp[2], "Amount: ", buf);
|
p = getstarg(player->argp[2], "Amount: ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
work_amt = atoi(p);
|
work_amt = atoi(p);
|
||||||
if ((work_amt < 0) || (work_amt > land_mob_max)) {
|
if ((work_amt < 0) || (work_amt > land_mob_max)) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ cnumb(char *cntry)
|
||||||
|
|
||||||
res = M_NOTFOUND;
|
res = M_NOTFOUND;
|
||||||
for (cn = 0; cn < MAXNOC; cn++) {
|
for (cn = 0; cn < MAXNOC; cn++) {
|
||||||
if ((natp = getnatp(cn)) == 0)
|
if (!(natp = getnatp(cn)))
|
||||||
break;
|
break;
|
||||||
if (natp->nat_stat == STAT_UNUSED)
|
if (natp->nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -153,7 +153,7 @@ keylookup(char *command, struct keymatch *tbl)
|
||||||
{
|
{
|
||||||
struct keymatch *kp;
|
struct keymatch *kp;
|
||||||
|
|
||||||
if (command == 0 || *command == 0)
|
if (!command || !*command)
|
||||||
return NULL;
|
return NULL;
|
||||||
for (kp = tbl; kp->km_key; kp++) {
|
for (kp = tbl; kp->km_key; kp++) {
|
||||||
if (strcmp(kp->km_key, command) == 0)
|
if (strcmp(kp->km_key, command) == 0)
|
||||||
|
|
|
@ -49,7 +49,7 @@ cname(natid n)
|
||||||
{
|
{
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
if ((np = getnatp(n)) == 0)
|
if (!(np = getnatp(n)))
|
||||||
return NULL;
|
return NULL;
|
||||||
return np->nat_cnam;
|
return np->nat_cnam;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ best_path(struct sctstr *from, struct sctstr *to, char *path,
|
||||||
struct as_data *adp;
|
struct as_data *adp;
|
||||||
struct as_path *ap;
|
struct as_path *ap;
|
||||||
|
|
||||||
if (mybestpath == 0)
|
if (!mybestpath)
|
||||||
mybestpath = bp_init();
|
mybestpath = bp_init();
|
||||||
adp = mybestpath->adp;
|
adp = mybestpath->adp;
|
||||||
ap = as_find_cachepath(from->sct_x, from->sct_y, to->sct_x, to->sct_y);
|
ap = as_find_cachepath(from->sct_x, from->sct_y, to->sct_x, to->sct_y);
|
||||||
|
|
|
@ -103,7 +103,7 @@ lwpReschedule(void)
|
||||||
if (nextp)
|
if (nextp)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (CANT_HAPPEN(LwpCurrent == 0 && nextp == 0))
|
if (CANT_HAPPEN(!LwpCurrent && !nextp))
|
||||||
abort();
|
abort();
|
||||||
if (LwpCurrent != nextp) {
|
if (LwpCurrent != nextp) {
|
||||||
struct lwpProc *oldp = LwpCurrent;
|
struct lwpProc *oldp = LwpCurrent;
|
||||||
|
|
|
@ -99,7 +99,7 @@ lwpSleepFd(int fd, int mask, struct timeval *timeout)
|
||||||
FD_SET(fd, &LwpWritefds);
|
FD_SET(fd, &LwpWritefds);
|
||||||
LwpNfds++;
|
LwpNfds++;
|
||||||
|
|
||||||
if (LwpMaxfd == 0 && LwpDelayq.head == 0) {
|
if (LwpMaxfd == 0 && !LwpDelayq.head) {
|
||||||
/* select process is sleeping until first waiter arrives */
|
/* select process is sleeping until first waiter arrives */
|
||||||
lwpStatus(LwpCurrent, "going to resched fd %d", fd);
|
lwpStatus(LwpCurrent, "going to resched fd %d", fd);
|
||||||
lwpReady(LwpSelProc);
|
lwpReady(LwpSelProc);
|
||||||
|
@ -194,7 +194,7 @@ lwpSleepUntil(time_t until)
|
||||||
lwpStatus(LwpCurrent, "sleeping for %ld sec",
|
lwpStatus(LwpCurrent, "sleeping for %ld sec",
|
||||||
(long)(until - time(NULL)));
|
(long)(until - time(NULL)));
|
||||||
LwpCurrent->runtime = until;
|
LwpCurrent->runtime = until;
|
||||||
if (LwpMaxfd == 0 && LwpDelayq.head == 0) {
|
if (LwpMaxfd == 0 && !LwpDelayq.head) {
|
||||||
/* select process is sleeping until first waiter arrives */
|
/* select process is sleeping until first waiter arrives */
|
||||||
lwpReady(LwpSelProc);
|
lwpReady(LwpSelProc);
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ lwpSelect(void *arg)
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
/* file descriptor activity */
|
/* file descriptor activity */
|
||||||
for (fd = 0; fd <= LwpMaxfd; fd++) {
|
for (fd = 0; fd <= LwpMaxfd; fd++) {
|
||||||
if (LwpFdwait[fd] == 0)
|
if (!LwpFdwait[fd])
|
||||||
continue;
|
continue;
|
||||||
if (FD_ISSET(fd, &readmask)) {
|
if (FD_ISSET(fd, &readmask)) {
|
||||||
lwpStatus(LwpFdwait[fd], "input ready");
|
lwpStatus(LwpFdwait[fd], "input ready");
|
||||||
|
|
|
@ -117,7 +117,7 @@ player_delete(struct player *lp)
|
||||||
struct player *
|
struct player *
|
||||||
player_next(struct player *lp)
|
player_next(struct player *lp)
|
||||||
{
|
{
|
||||||
if (lp == 0)
|
if (!lp)
|
||||||
lp = (struct player *)Players.q_forw;
|
lp = (struct player *)Players.q_forw;
|
||||||
else
|
else
|
||||||
lp = (struct player *)lp->queue.q_forw;
|
lp = (struct player *)lp->queue.q_forw;
|
||||||
|
@ -129,7 +129,7 @@ player_next(struct player *lp)
|
||||||
struct player *
|
struct player *
|
||||||
player_prev(struct player *lp)
|
player_prev(struct player *lp)
|
||||||
{
|
{
|
||||||
if (lp == 0)
|
if (!lp)
|
||||||
lp = (struct player *)Players.q_back;
|
lp = (struct player *)Players.q_back;
|
||||||
else
|
else
|
||||||
lp = (struct player *)lp->queue.q_back;
|
lp = (struct player *)lp->queue.q_back;
|
||||||
|
|
|
@ -81,7 +81,7 @@ dispatch(char *buf, char *redir)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (command->c_addr == 0) {
|
if (!command->c_addr) {
|
||||||
pr("Command not implemented\n");
|
pr("Command not implemented\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ confirm(char *promptstring)
|
||||||
char y_or_n[1024];
|
char y_or_n[1024];
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
if (getstring(promptstring, y_or_n) == 0)
|
if (!getstring(promptstring, y_or_n))
|
||||||
return 0;
|
return 0;
|
||||||
c = *y_or_n;
|
c = *y_or_n;
|
||||||
if (c == 'y' || c == 'Y')
|
if (c == 'y' || c == 'Y')
|
||||||
|
|
|
@ -46,8 +46,8 @@ char *
|
||||||
getstarg(char *input, char *prompt, char *buf)
|
getstarg(char *input, char *prompt, char *buf)
|
||||||
{
|
{
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
if (input == 0 || *input == 0) {
|
if (!input || !*input) {
|
||||||
if (getstring(prompt, buf) == 0)
|
if (!getstring(prompt, buf))
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
strcpy(buf, input);
|
strcpy(buf, input);
|
||||||
|
|
|
@ -913,7 +913,7 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
|
||||||
break;
|
break;
|
||||||
case 't': /* transport */
|
case 't': /* transport */
|
||||||
case 'd': /* drop */
|
case 'd': /* drop */
|
||||||
if ((pcp->pl_flags & P_C) == 0 || ip == 0)
|
if (!(pcp->pl_flags & P_C) || !ip)
|
||||||
break;
|
break;
|
||||||
itype = ip->i_uid;
|
itype = ip->i_uid;
|
||||||
needed = (load * 2) / ip->i_lbs;
|
needed = (load * 2) / ip->i_lbs;
|
||||||
|
|
|
@ -49,7 +49,7 @@ comtch(char *command, struct cmndstr *coms, int comstat)
|
||||||
struct cmndstr *com;
|
struct cmndstr *com;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (command == 0 || *command == 0)
|
if (!command || !*command)
|
||||||
return M_IGNORE;
|
return M_IGNORE;
|
||||||
status = M_NOTFOUND;
|
status = M_NOTFOUND;
|
||||||
for (com = coms; com->c_form; com++) {
|
for (com = coms; com->c_form; com++) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ natargp(char *arg, char *prompt)
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
arg = getstarg(arg, prompt, buf);
|
arg = getstarg(arg, prompt, buf);
|
||||||
if (arg == 0 || *arg == 0)
|
if (!arg || !*arg)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (isdigit(*arg))
|
if (isdigit(*arg))
|
||||||
n = atoi(arg);
|
n = atoi(arg);
|
||||||
|
|
|
@ -77,7 +77,7 @@ nreport(natid actor, int event, natid victim, int times)
|
||||||
return;
|
return;
|
||||||
if (!chance((double)-nice * times / 20.0))
|
if (!chance((double)-nice * times / 20.0))
|
||||||
return;
|
return;
|
||||||
if ((natp = getnatp(victim)) == 0)
|
if (!(natp = getnatp(victim)))
|
||||||
return;
|
return;
|
||||||
if (getrel(natp, actor) < HOSTILE)
|
if (getrel(natp, actor) < HOSTILE)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -41,8 +41,8 @@ onearg(char *arg, char *prompt)
|
||||||
int n;
|
int n;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if (arg == 0 || *arg == 0) {
|
if (!arg || !*arg) {
|
||||||
if ((arg = getstring(prompt, buf)) == 0)
|
if (!(arg = getstring(prompt, buf)))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
n = atoi(arg);
|
n = atoi(arg);
|
||||||
|
|
|
@ -270,7 +270,7 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
|
||||||
int there;
|
int there;
|
||||||
int max;
|
int max;
|
||||||
|
|
||||||
if (ip == 0)
|
if (!ip)
|
||||||
return;
|
return;
|
||||||
amt = 0;
|
amt = 0;
|
||||||
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
||||||
|
@ -664,7 +664,7 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
|
||||||
break;
|
break;
|
||||||
case 't': /* transport */
|
case 't': /* transport */
|
||||||
case 'd': /* drop */
|
case 'd': /* drop */
|
||||||
if ((pcp->pl_flags & P_C) == 0 || ip == 0)
|
if (!(pcp->pl_flags & P_C) || !ip)
|
||||||
break;
|
break;
|
||||||
itype = ip->i_uid;
|
itype = ip->i_uid;
|
||||||
needed = (load * 2) / ip->i_lbs;
|
needed = (load * 2) / ip->i_lbs;
|
||||||
|
|
|
@ -149,7 +149,7 @@ setcont(natid us, natid them, int contact)
|
||||||
{
|
{
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
if ((np = getnatp(us)) == 0)
|
if (!(np = getnatp(us)))
|
||||||
return 0;
|
return 0;
|
||||||
putcontact(np, them, contact);
|
putcontact(np, them, contact);
|
||||||
putnat(np);
|
putnat(np);
|
||||||
|
@ -161,7 +161,7 @@ setrej(natid us, natid them, int how, int what)
|
||||||
{
|
{
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
if ((np = getnatp(us)) == 0)
|
if (!(np = getnatp(us)))
|
||||||
return 0;
|
return 0;
|
||||||
putreject(np, them, how, what);
|
putreject(np, them, how, what);
|
||||||
putnat(np);
|
putnat(np);
|
||||||
|
|
|
@ -66,13 +66,13 @@ snxtitem(struct nstr_item *np, int type, char *str, char *prompt)
|
||||||
|
|
||||||
np->type = EF_BAD;
|
np->type = EF_BAD;
|
||||||
np->sel = NS_UNDEF;
|
np->sel = NS_UNDEF;
|
||||||
if (str == 0) {
|
if (!str) {
|
||||||
if (!prompt) {
|
if (!prompt) {
|
||||||
sprintf(promptbuf, "%s(s)? ", ef_nameof(type));
|
sprintf(promptbuf, "%s(s)? ", ef_nameof(type));
|
||||||
prompt = promptbuf;
|
prompt = promptbuf;
|
||||||
}
|
}
|
||||||
str = getstring(prompt, buf);
|
str = getstring(prompt, buf);
|
||||||
if (str == 0)
|
if (!str)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (*str == 0) {
|
if (*str == 0) {
|
||||||
|
@ -126,7 +126,7 @@ snxtitem(struct nstr_item *np, int type, char *str, char *prompt)
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (player->condarg == 0)
|
if (!player->condarg)
|
||||||
return 1;
|
return 1;
|
||||||
n = nstr_comp(np->cond, sizeof(np->cond) / sizeof(*np->cond), type,
|
n = nstr_comp(np->cond, sizeof(np->cond) / sizeof(*np->cond), type,
|
||||||
player->condarg);
|
player->condarg);
|
||||||
|
|
|
@ -61,8 +61,8 @@ snxtsct(struct nstr_sect *np, char *str)
|
||||||
int dist, n;
|
int dist, n;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if (str == 0 || *str == 0) {
|
if (!str || !*str) {
|
||||||
if ((str = getstring("(sects)? ", buf)) == 0)
|
if (!(str = getstring("(sects)? ", buf)))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (sarg_type(str)) {
|
switch (sarg_type(str)) {
|
||||||
|
@ -92,7 +92,7 @@ snxtsct(struct nstr_sect *np, char *str)
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (player->condarg == 0)
|
if (!player->condarg)
|
||||||
return 1;
|
return 1;
|
||||||
n = nstr_comp(np->cond, sizeof(np->cond) / sizeof(*np->cond),
|
n = nstr_comp(np->cond, sizeof(np->cond) / sizeof(*np->cond),
|
||||||
EF_SECTOR, player->condarg);
|
EF_SECTOR, player->condarg);
|
||||||
|
|
|
@ -48,7 +48,7 @@ whatitem(char *input, char *prompt)
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
p = getstarg(input, prompt, buf);
|
p = getstarg(input, prompt, buf);
|
||||||
if (p == 0 || *p == 0)
|
if (!p || !*p)
|
||||||
return NULL;
|
return NULL;
|
||||||
ip = item_by_name(p);
|
ip = item_by_name(p);
|
||||||
if (!ip)
|
if (!ip)
|
||||||
|
|
|
@ -131,7 +131,7 @@ typed_wu(natid from, natid to, char *message, int type)
|
||||||
mailbox(box, to);
|
mailbox(box, to);
|
||||||
|
|
||||||
if (type != TEL_ANNOUNCE)
|
if (type != TEL_ANNOUNCE)
|
||||||
if ((np = getnatp(to)) == 0 || np->nat_stat < STAT_SANCT)
|
if (!(np = getnatp(to)) || np->nat_stat < STAT_SANCT)
|
||||||
return -1;
|
return -1;
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
if ((fd = open(box, O_WRONLY | O_APPEND, 0)) < 0) {
|
if ((fd = open(box, O_WRONLY | O_APPEND, 0)) < 0) {
|
||||||
|
|
|
@ -137,7 +137,7 @@ update_main(void)
|
||||||
/* Update war declarations */
|
/* Update war declarations */
|
||||||
/* MOBILIZATION->SITZKRIEG->AT_WAR */
|
/* MOBILIZATION->SITZKRIEG->AT_WAR */
|
||||||
for (cn = 1; cn < MAXNOC; cn++) {
|
for (cn = 1; cn < MAXNOC; cn++) {
|
||||||
if ((cnp = getnatp(cn)) == 0)
|
if (!(cnp = getnatp(cn)))
|
||||||
break;
|
break;
|
||||||
for (cn2 = 1; cn2 < MAXNOC; cn2++) {
|
for (cn2 = 1; cn2 < MAXNOC; cn2++) {
|
||||||
if (cn2 == cn)
|
if (cn2 == cn)
|
||||||
|
|
|
@ -284,7 +284,7 @@ nav_ship(struct shpstr *sp)
|
||||||
cp = BestShipPath(buf, sp->shp_x, sp->shp_y,
|
cp = BestShipPath(buf, sp->shp_x, sp->shp_y,
|
||||||
sp->shp_destx[0], sp->shp_desty[0],
|
sp->shp_destx[0], sp->shp_desty[0],
|
||||||
sp->shp_own);
|
sp->shp_own);
|
||||||
if (cp == 0) {
|
if (!cp) {
|
||||||
wu(0, cnum,
|
wu(0, cnum,
|
||||||
"%s bad path, ship put on standby\n", prship(sp));
|
"%s bad path, ship put on standby\n", prship(sp));
|
||||||
sp->shp_autonav |= AN_STANDBY;
|
sp->shp_autonav |= AN_STANDBY;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue