This part replaces E == 0 by !E, where E has pointer type.
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)))
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;
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) {
}
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");
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':
}
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)) {
char buf[1024];
cp = getstarg(player->argp[1], "army? ", buf);
- if (cp == 0)
+ if (!cp)
return RET_SYN;
c = *cp;
if (!isalpha(c) && c != '~') {
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;
}
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;
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;
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;
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;
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;
}
}
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;
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)
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;
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) {
}
}
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;
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);
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);
}
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) {
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;
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;
}
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);
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) {
pr("huh?\n");
return RET_SYN;
}
- if (player->argp[3] == 0) {
+ if (!player->argp[3]) {
switch (ewhat) {
case 'l':
prsect(§);
{
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);
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;
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;
char buf[1024];
cp = getstarg(player->argp[1], "fleet? ", buf);
- if (cp == 0)
+ if (!cp)
return RET_SYN;
c = *cp;
if (!isalpha(c) && c != '~') {
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;
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)
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)
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;
}
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;
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;
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;
}
return RET_FAIL;
}
p = getstring("Geostationary orbit? ", buf);
- if (p == 0)
+ if (!p)
return RET_SYN;
if (!check_plane_ok(pp))
return RET_FAIL;
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) {
p = getstarg(player->argp[3],
"Mission (int, sup, osup, dsup, esc, res, air, query, clear)? ",
buf);
- if (p == 0)
+ if (!p)
return RET_SYN;
/*
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)))
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;
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;
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;
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;
return RET_SYN;
}
cp = getstring("Proposed treaty duration? (days) ", buf);
- if (cp == 0)
+ if (!cp)
return RET_FAIL;
j = atoi(cp);
if (j <= 0) {
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);
}
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;
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:
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;
}
return RET_SYN;
}
}
- if (player->argp[2] == 0) {
+ if (!player->argp[2]) {
while (curr <= lastr) {
list_realm(curr, natp);
curr++;
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;
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':
}
p = getstarg(player->argp[2],
"mail, treaties, loans, or announcements? ", buf);
- if (p == 0)
+ if (!p)
return RET_SYN;
switch (*p) {
case 'a':
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)
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;
}
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)
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;
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;
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]))
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;
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;
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");
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;
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':
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];
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;
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)
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);
}
} 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) {
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;
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;
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;
}
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;
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, §)) {
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, §)) {
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();
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)) {
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;
{
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)
{
struct natstr *np;
- if ((np = getnatp(n)) == 0)
+ if (!(np = getnatp(n)))
return NULL;
return np->nat_cnam;
}
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);
if (nextp)
break;
}
- if (CANT_HAPPEN(LwpCurrent == 0 && nextp == 0))
+ if (CANT_HAPPEN(!LwpCurrent && !nextp))
abort();
if (LwpCurrent != nextp) {
struct lwpProc *oldp = LwpCurrent;
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);
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);
}
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");
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;
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;
return 0;
}
}
- if (command->c_addr == 0) {
+ if (!command->c_addr) {
pr("Command not implemented\n");
return 0;
}
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')
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);
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;
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++) {
struct natstr *np;
arg = getstarg(arg, prompt, buf);
- if (arg == 0 || *arg == 0)
+ if (!arg || !*arg)
return NULL;
if (isdigit(*arg))
n = atoi(arg);
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;
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);
int there;
int max;
- if (ip == 0)
+ if (!ip)
return;
amt = 0;
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
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;
{
struct natstr *np;
- if ((np = getnatp(us)) == 0)
+ if (!(np = getnatp(us)))
return 0;
putcontact(np, them, contact);
putnat(np);
{
struct natstr *np;
- if ((np = getnatp(us)) == 0)
+ if (!(np = getnatp(us)))
return 0;
putreject(np, them, how, what);
putnat(np);
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) {
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);
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)) {
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);
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)
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) {
/* 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)
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;