]> git.pond.sub.org Git - empserver/commitdiff
Don't use 0 as null pointer constant, part 3
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 23 Mar 2009 21:58:54 +0000 (22:58 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 24 Mar 2009 20:46:01 +0000 (21:46 +0100)
This part replaces E == 0 by !E, where E has pointer type.

79 files changed:
src/lib/commands/acce.c
src/lib/commands/add.c
src/lib/commands/army.c
src/lib/commands/bdes.c
src/lib/commands/bomb.c
src/lib/commands/buil.c
src/lib/commands/buy.c
src/lib/commands/cede.c
src/lib/commands/chan.c
src/lib/commands/coas.c
src/lib/commands/cons.c
src/lib/commands/deli.c
src/lib/commands/desi.c
src/lib/commands/drop.c
src/lib/commands/edit.c
src/lib/commands/enli.c
src/lib/commands/expl.c
src/lib/commands/flee.c
src/lib/commands/fly.c
src/lib/commands/foll.c
src/lib/commands/fort.c
src/lib/commands/give.c
src/lib/commands/grin.c
src/lib/commands/info.c
src/lib/commands/laun.c
src/lib/commands/miss.c
src/lib/commands/move.c
src/lib/commands/name.c
src/lib/commands/new.c
src/lib/commands/offe.c
src/lib/commands/orde.c
src/lib/commands/para.c
src/lib/commands/rada.c
src/lib/commands/rea.c
src/lib/commands/real.c
src/lib/commands/reco.c
src/lib/commands/reje.c
src/lib/commands/rela.c
src/lib/commands/repa.c
src/lib/commands/rese.c
src/lib/commands/rout.c
src/lib/commands/scra.c
src/lib/commands/scut.c
src/lib/commands/set.c
src/lib/commands/setres.c
src/lib/commands/setsect.c
src/lib/commands/shark.c
src/lib/commands/shoo.c
src/lib/commands/skyw.c
src/lib/commands/stop.c
src/lib/commands/terr.c
src/lib/commands/thre.c
src/lib/commands/torp.c
src/lib/commands/trad.c
src/lib/commands/tran.c
src/lib/commands/work.c
src/lib/common/cnumb.c
src/lib/common/emp_config.c
src/lib/common/nat.c
src/lib/common/path.c
src/lib/lwp/lwp.c
src/lib/lwp/sel.c
src/lib/player/accept.c
src/lib/player/dispatch.c
src/lib/subs/askyn.c
src/lib/subs/getstarg.c
src/lib/subs/mission.c
src/lib/subs/mtch.c
src/lib/subs/natarg.c
src/lib/subs/nreport.c
src/lib/subs/onearg.c
src/lib/subs/plnsub.c
src/lib/subs/rej.c
src/lib/subs/snxtitem.c
src/lib/subs/snxtsct.c
src/lib/subs/whatitem.c
src/lib/subs/wu.c
src/lib/update/main.c
src/lib/update/nav_ship.c

index a6d7494abd0d8111e403e31947a6c5e0a4b8b6e3..301cdeca1b5989f0d0b73b5cbbf8724d5172f85a 100644 (file)
@@ -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;
index 2343e674776eae195c58c6eee691d3cb3630bf82..71067f7bc88d59e553aa49c4bf1af59873c0c0e0 100644 (file)
@@ -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)) {
index 2dc8bc7cdfa51c598964cff3c0b1b40aa55f0277..1236b2bb012f4fc9a21893e08532d677f7257def 100644 (file)
@@ -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 != '~') {
index 59454841f47870c73a4a62d5089a652854f2ce61..e2d60ce451d01dfb9f4efb5fd5b29ee645eb77f0 100644 (file)
@@ -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;
        }
index 19de35bbc9ba1a1a66877f5cfbc5b07bd461b289..580761cf1253b3fb3be482110c7f40a72df5e58a 100644 (file)
@@ -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;
index 4cd38f1d551ad8ec1e35ec3b66a4b7e52fcc4b96..83f875965326cecd7c81be2d97f4e6f48f1e0d83 100644 (file)
@@ -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;
            }
        }
index 0d0f38364852d404154f19d1b5ff8ac1ee300123..2f8dcbaafe44a5ddbadec8d7704f81d51be8c08c 100644 (file)
@@ -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)
index 656a2eb6ffaed95583869bd1b9451270c84b2783..ff1b462ce8dee5b8ff606972dde61dee0a76ba18 100644 (file)
@@ -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;
index 21903f2918f241cbe147790abd175d157c0c3730..bbb750917f71d193bcafb55fb1f74a20660e2928 100644 (file)
@@ -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);
index 0ba06e2e2008e594d6aff90c2b9fe5f669d35a09..30fb62fa550c6cbcf79aaf0fd7b7d85b4fb150fd 100644 (file)
@@ -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);
            }
index 27fb90f38c617f993139509fbd9460c2d2b9a86d..04cd21ca50c3fb65570f777f55b555adc204713b 100644 (file)
@@ -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) {
index a433b3969973198dab9b9c9652ddf4e5f612a09b..d578d62f3cb4750f58af37c328d6f10d91512339 100644 (file)
@@ -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;
index c4da041b9d2e99d8d9e9c52ba321060f0e67c901..c7209e97075a1b54dba44e0bdde49b5bd5a1618e 100644 (file)
@@ -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;
        }
index dba068fe19166b7b6023f2f40eef2819e9a55a9f..c1ea70ebc68a684ea6ace8e4074814866b5bf055 100644 (file)
@@ -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);
 
index 72eefce93f4425f8694c0cc9152ff37460e6cfbf..f796228580682fb4fc12c5b874fdbe631ea522c9 100644 (file)
@@ -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(&sect);
@@ -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);
index d02556991896b2cb0741ac394a5fc87cef2a9bce..42e53a2f3f657cc7a4d6b6a887bd2e3553e3ae73 100644 (file)
@@ -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;
index c34a39c6b5a7e7b466dab7a501bfcbef92e4075e..e12afa61b7f11a2af92920b3f12f583d82c5c230 100644 (file)
@@ -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;
index 14e39c5eb4b6186a13546ad172b952397f0ffacd..22f4f4b4e5733d03f39196d167f35af83d3d658a 100644 (file)
@@ -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 != '~') {
index 50efe6ff27b68e3a6952c3e26c8aa24393f12e2d..bc5c445b7ce6e61e4cb6c52b6efb59a8d5b67381 100644 (file)
@@ -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;
index 42c65dbf1a7e98be77568c02344f8b2e87d10c53..46e3853b5725294ac4740c79e68f4d4a4e27c46e 100644 (file)
@@ -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)
index f45fc5f6398376364acd184a4ed67520c916fae0..03d5d8117fcd40ebd99748f89e8f146d95250511 100644 (file)
@@ -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)
index 8142b7e059294833b1e51e5f3b24c5601b7147f6..75ae1f9a0916fbc73be908bcb41effc32902b14b 100644 (file)
@@ -59,7 +59,7 @@ give(void)
        return RET_SYN;
     while (nxtsct(&nstr, &sect) > 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;
index 0486a50516eacae244967c106a7216f15560494f..92a3ba2e9f623fbfdee74f1f6cdf91b521371a48 100644 (file)
@@ -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;
index 8b3993a9f2c51b42101ee62f972dacebdc61602a..700ba9b6bcda6151e9a079fd0544318f8ea87464 100644 (file)
@@ -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;
     }
index 2cc523ce830e66434202e04a9b98b5631094e2e6..86b21c5e3309a8852acb49efefbf893dbcd02ae4 100644 (file)
@@ -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;
index 16d60b2fe1466703fc64e23ae2b5e55d676b78f0..a3a72336269469da3c26331ff8429180e8a5b5c8 100644 (file)
@@ -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;
 
 /*
index 005a10cf2914a5ff87fde472e139127116bd2975..e369572d5da8b675338e340859724a7258cc66b4 100644 (file)
@@ -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)))
index 887918dbbe25ad822e7d55510766a1df31a735bb..0d6958a4c84d48943c39e5bbbf0bdbad2ca5f02f 100644 (file)
@@ -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;
index 311039bc8efecaf7f64a018ccc5953f5b65b430d..1584f1d46eeb0e6bb1a4ba97011d8847ec7b3cd5 100644 (file)
@@ -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, &sect))
        return RET_SYN;
index 88e47b7959d1491ea7997bbbcc3e57a7afe6ce42..2ddc73b68d520bf3ed97274dfc64c5ab00af25b6 100644 (file)
@@ -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) {
index 2c2ea7560446df980fd2479507b0f2f96f34d467..9ccec04f115116521b3e2612f658a0b9d00e9dda 100644 (file)
@@ -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);
            }
index fec94553e39eef8614fc22650943875562286d18..081a8b0cf696a1e079ede157fbc0bda5b01772a1 100644 (file)
@@ -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;
index 401a40618912ac2551be4f717095e4d8080d2c69..cfe6ad06efc33219002a85e38507b458996ccd31 100644 (file)
@@ -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:
index dee5c6745f6aa664b25e4f5738516352b2b1836b..37fe828f856a3569c06588c4e339644ec521c5b2 100644 (file)
@@ -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;
     }
index 2a5c768669c05cb2c9bc141b6b2f164b93d69027..a57eba802ebfc221eafaf7ba88d9cf7176471f0d 100644 (file)
@@ -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++;
index b0fb44583a902f181b4bd324fdb59f67bc030d33..4afb2e63d731d35434a65a0490161ad312b9adc7 100644 (file)
@@ -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;
index 4c165ca8c736f9543ec8caf4073bd5c6ee2269b4..e8ddead201b8c2a9ffd72386ee0dd6b97a74e247 100644 (file)
@@ -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':
index 416d02f1e996f53ee5b1f358b683b0f66f897839..dcc0402167f5e443cbf6f1b5ac13adcf3ba29ca5 100644 (file)
@@ -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;
index b0c682301fcb292813c41e3851fc32e337974aa4..51a47564bb242479f5e495411484995926950845 100644 (file)
@@ -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;
index fd7a5414165b0cadefea47315503c851a0de58b8..88b4e280ccb889133662d1d18d7328a3ca01d905 100644 (file)
@@ -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;
index 244cff2cb7e60c7d338daf17e2760354269f2b5b..29d9bafea8a1ab369a5e05fbc30cdd6ca9c9f9c8 100644 (file)
@@ -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]))
index 5f7f86ea44f5bd9b4f3c8e4edc9d0407a2a45c32..9164b888128a23449f96d565359c16adb9bcbd8a 100644 (file)
@@ -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;
index 219fd6bda97e275be50cf723e86e2a7dcc4ca889..5d6d6014a449f34989eb248fcf61438f33dfd23e 100644 (file)
@@ -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;
index 690fbbe786a5b22b02d0a93b3699a1195effe1ea..149e80107c849a822d9dab2228e09cad106d7dee 100644 (file)
@@ -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;
index 4d198652329ef15309a316146704c3d0223310a2..ae3f50af49722e1ea39f32088cedd45741a04ac0 100644 (file)
@@ -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':
index a1d2fb4497e9cbadf844582f9ac9bd94c2f59e2c..eae4344abbc350eba76de98448fec19b68bce0cc 100644 (file)
@@ -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];
index 064b2c78d3870274ff1007df1ee621df9bca6d0f..8b1aa4bf03f1ec3da779ada72c9864a6123b852b 100644 (file)
@@ -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;
index f7e2b8a7c6c29f656fc9bc0bea8c1421aa73b057..3704f4d958403726c783ddb74df4bcf49b0045a3 100644 (file)
@@ -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, &sect)) {
        if (!player->owner)
index 95003e87a8e2808c71c70a3680128dde541c6606..7816f5ac07a377550d27431e89ba1ed5734c6ff2 100644 (file)
@@ -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);
            }
index e931c725b96a35b4d57f17c500632181c1a03b3f..c5e9829ebc652d77deacfc1bc2d1d1e15a3bdb80 100644 (file)
@@ -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) {
index f52a42dbfb08e48844826469df3a3a3000c66a07..da9aa57395c587248db6668955dc2ee4411be135 100644 (file)
@@ -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;
index 568474ea94beac0af30f134365d8cea63fdaf1e9..a4d5d0aa784ef278f1f46c1af3007c4b9423c874 100644 (file)
@@ -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;
index 31d0f2e7f21377402be260be48618be643d71165..908ac6209b77242a376438f0f6ce6c62ce822fea 100644 (file)
@@ -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;
index f317359289740bfb0729b44ce7493d49e8aaf6cf..310ae402e85b53ec7945494bfd88af2dbbcfa83d 100644 (file)
@@ -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, &sect)) {
@@ -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, &sect)) {
index 55cd2c55013871cdf1d4e7e435f0db8780833efc..bf8c971f93693036ae989899da5dca5de24afe9d 100644 (file)
@@ -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();
index ea9b0042a9a1ebef368d08624949b4055b9dc786..888848d275da7e8fcde7231f426a53a08d78c2c9 100644 (file)
@@ -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)) {
index c490623bbea2683955c79100ac0f2465ef6139f4..d82d572e49aa3098853ee29cc41ecf5d01735ab8 100644 (file)
@@ -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;
index 0186352e92d4e04a24b43b4991632b9bfdd55de4..bb1f6b5fd3fe0d916afa8ed03cd17ab8f6ba21c2 100644 (file)
@@ -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)
index a4fec30fb29ebffade46d94c9eb489af2599636e..cbfa623050bcae6e202bf63028d001ae85aeb540 100644 (file)
@@ -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;
 }
index 40abdfbb1553d278c960b75e1b1210e6bea3e4c3..41bd0473ee156688827e01a222c9e9a70fedb95f 100644 (file)
@@ -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);
index 6a47ac61252443040ae644819e1bda0ff99f2868..55269314f9bf653f2837b9ea27228894272e571b 100644 (file)
@@ -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;
index 1a44d272201b02bbf272b5c406c170e379597182..619d87c92be02dd44092869647c85c38c5358fcf 100644 (file)
@@ -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");
index 474a51afe6f1e91a6fbd02e6033b9244b40c2117..321e21bbe4c6cacc01a1d98f8176f89b34ea526c 100644 (file)
@@ -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;
index f629f5d383a42a09f2b481e60977bc4eb08467ae..90a75fdb9ae5182b580d6f2e01a463cd77fe4c16 100644 (file)
@@ -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;
     }
index e87e403881555f13b5ccf20995c95ce03f46df0a..5686c4c28c8a02e017971dc6b24296cfc4b055e1 100644 (file)
@@ -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')
index 20a0df843c362a3f8ae2087ea90d21301f0437ab..f8bd7ff4dd8d008bf4828b4a4c6701a9ad8eb38e 100644 (file)
@@ -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);
index 2c6cba992e450d9c2892493a5c10d445557482c3..03dea9064dd9bd6d4cd5e09bf4e40369ab78b72b 100644 (file)
@@ -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;
index e6a2835bf2946ea3cf151282b5f74e9e0f21dc12..1b5c9ebb4dc40f8db29dab4e557ec3235a2e946d 100644 (file)
@@ -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++) {
index 051bf7ee3f711d8f95ed09dde15bd83cb1f518c4..cf000dacdc920e11e33589a101c22fa01a3093c0 100644 (file)
@@ -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);
index 0bce946221c4aced961b26865487beda8370893c..5d5604d5b9b662a3ab27cbb1f102ad79da297997 100644 (file)
@@ -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;
index f7db1ff9bd14e28210df7679880216c78a94be13..0db17a565e690dd4cd77fdbc2423a1b9295d319c 100644 (file)
@@ -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);
index 9a1eca919a0af33e4c00cc9dad472af39c4fce7b..b13a7e0ef7062e25bb31a80914655ff81acb07b3 100644 (file)
@@ -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;
index 799630da436e7b18eeb968a3dad29e5cd89231f1..756ae4dfb25a3357fcacbc1512457eef6db0cbc3 100644 (file)
@@ -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);
index 47cb7dae4d294aa52210f6b91df3c973ad1e5797..f45504f8d25267322d94b95e733fe3ad67916965 100644 (file)
@@ -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);
index 3ce0f95973f2287ae0958beebc6e099466fdc154..6627035f35b7e49b4539c65b420647c4d3f237e6 100644 (file)
@@ -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);
index 0d925189a140e4745c083ebf06e71f98660af9b2..71322d597308401efa3b38484fcc4c1d853ea614 100644 (file)
@@ -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)
index 4cf5cea84d075ca59f54e125d87e1d69024322d2..68b267763630a739d89a4c525dc0a838cd85a6e8 100644 (file)
@@ -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) {
index 730befbb60bed25a9407146303927211bd1fae43..3a552247015c63463002b280d8d84307f5340faf 100644 (file)
@@ -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)
index d57ed6aac4e1bef75fa515cd05efdc6fd3efa624..32c01c08f6fa3a92d6cd578a65f43c23a811049e 100644 (file)
@@ -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;