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