Clean up more booleans.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 19 Sep 2006 23:56:55 +0000 (23:56 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 19 Sep 2006 23:56:55 +0000 (23:56 +0000)
src/ai.c
src/battle.c
src/events.c
src/planets.c
src/reports.c
src/setup.c
src/sst.c
src/sst.h

index e524a8e09ec8e5c9324b4e74c1525837328a268d..6fc79080ed1112d1579c8327009a3688ba453a28 100644 (file)
--- a/src/ai.c
+++ b/src/ai.c
@@ -45,14 +45,13 @@ static bool tryexit(int lookx, int looky, int ienm, int loccom, int irun)
     game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons--;
     game.state.galaxy[iq.x][iq.y].klingons++;
     if (ienm==IHS) {
     game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons--;
     game.state.galaxy[iq.x][iq.y].klingons++;
     if (ienm==IHS) {
-       game.ishere=0;
-       game.iscate=0;
-       game.ientesc=0;
-       game.isatb=0;
+       game.ishere = false;
+       game.iscate = 0;
+       game.ientesc = false;
+       game.isatb = 0;
        schedule(FSCMOVE, 0.2777);
        unschedule(FSCDBAS);
        schedule(FSCMOVE, 0.2777);
        unschedule(FSCDBAS);
-       game.state.kscmdr.x=iq.x;
-       game.state.kscmdr.y=iq.y;
+       game.state.kscmdr=iq;
     }
     else {
        for_commanders(n) {
     }
     else {
        for_commanders(n) {
@@ -317,8 +316,8 @@ static bool movescom(coord iq, bool flag, bool *ipage)
        /* SC has scooted, Remove him from current quadrant */
        game.iscate=0;
        game.isatb=0;
        /* SC has scooted, Remove him from current quadrant */
        game.iscate=0;
        game.isatb=0;
-       game.ishere=0;
-       game.ientesc=0;
+       game.ishere = false;
+       game.ientesc = false;
        unschedule(FSCDBAS);
        for_local_enemies(i) 
            if (game.quad[game.ks[i].x][game.ks[i].y] == IHS) break;
        unschedule(FSCDBAS);
        for_local_enemies(i) 
            if (game.quad[game.ks[i].x][game.ks[i].y] == IHS) break;
@@ -535,7 +534,7 @@ void movetho(void)
     int idx, idy, im, i;
     coord dummy;
     /* Move the Tholian */
     int idx, idy, im, i;
     coord dummy;
     /* Move the Tholian */
-    if (game.ithere==0 || game.justin == 1) return;
+    if (!game.ithere || game.justin) return;
 
     if (game.tholian.x == 1 && game.tholian.y == 1) {
        idx = 1; idy = QUADSIZE;
 
     if (game.tholian.x == 1 && game.tholian.y == 1) {
        idx = 1; idy = QUADSIZE;
@@ -551,7 +550,7 @@ void movetho(void)
     }
     else {
        /* something is wrong! */
     }
     else {
        /* something is wrong! */
-       game.ithere = 0;
+       game.ithere = false;
        return;
     }
 
        return;
     }
 
@@ -590,7 +589,8 @@ void movetho(void)
     dropin(IHBLANK, &dummy);
     crmena(true, IHT, sector, game.tholian);
     prout(_(" completes web."));
     dropin(IHBLANK, &dummy);
     crmena(true, IHT, sector, game.tholian);
     prout(_(" completes web."));
-    game.ithere = game.tholian.x = game.tholian.y = 0;
+    game.ithere = false;
+    game.tholian.x = game.tholian.y = 0;
     game.nenhere--;
     return;
 }
     game.nenhere--;
     return;
 }
index 08a8b16a97a17a76ea0ea9415e9e7258bc78a808..dba9f295c13a762a20a5c78056af1eb4de7b3b07 100644 (file)
@@ -181,13 +181,14 @@ void ram(bool ibumpd, int ienm, coord w)
 void torpedo(double course, double r, int inx, int iny, double *hit, int i, int n)
 /* let a photon torpedo fly */
 {
 void torpedo(double course, double r, int inx, int iny, double *hit, int i, int n)
 /* let a photon torpedo fly */
 {
-    int l, iquad=0, jx=0, jy=0, shoved=0, ll;
-       
+    int l, iquad=0, jx=0, jy=0, ll;
+    bool shoved = false;
     double ac=course + 0.25*r;
     double angle = (15.0-ac)*0.5235988;
     double bullseye = (15.0 - course)*0.5235988;
     double deltax=-sin(angle), deltay=cos(angle), x=inx, y=iny, bigger;
     double ang, temp, xx, yy, kp, h1;
     double ac=course + 0.25*r;
     double angle = (15.0-ac)*0.5235988;
     double bullseye = (15.0 - course)*0.5235988;
     double deltax=-sin(angle), deltay=cos(angle), x=inx, y=iny, bigger;
     double ang, temp, xx, yy, kp, h1;
+    struct quadrant *q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
     coord w;
 
     w.x = w.y = 0;
     coord w;
 
     w.x = w.y = 0;
@@ -245,7 +246,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
            game.sector.x = jx;
            game.sector.y = jy;
            crmshp();
            game.sector.x = jx;
            game.sector.y = jy;
            crmshp();
-           shoved = 1;
+           shoved = true;
            break;
                                          
        case IHC: /* Hit a commander */
            break;
                                          
        case IHC: /* Hit a commander */
@@ -298,22 +299,21 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
            proutn(_(" damaged--"));
            game.ks[ll].x = jx;
            game.ks[ll].y = jy;
            proutn(_(" damaged--"));
            game.ks[ll].x = jx;
            game.ks[ll].y = jy;
-           shoved = 1;
+           shoved = true;
            break;
        case IHB: /* Hit a base */
            skip(1);
            prout(_("***STARBASE DESTROYED.."));
            for_starbases(ll) {
            break;
        case IHB: /* Hit a base */
            skip(1);
            prout(_("***STARBASE DESTROYED.."));
            for_starbases(ll) {
-               if (game.state.baseq[ll].x==game.quadrant.x && game.state.baseq[ll].y==game.quadrant.y) {
-                   game.state.baseq[ll].x=game.state.baseq[game.state.rembase].x;
-                   game.state.baseq[ll].y=game.state.baseq[game.state.rembase].y;
+               if (same(game.state.baseq[ll], game.quadrant)) {
+                   game.state.baseq[ll]=game.state.baseq[game.state.rembase];
                    break;
                }
            }
            game.quad[w.x][w.y]=IHDOT;
            game.state.rembase--;
            game.base.x=game.base.y=0;
                    break;
                }
            }
            game.quad[w.x][w.y]=IHDOT;
            game.state.rembase--;
            game.base.x=game.base.y=0;
-           game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase--;
+           q->starbase--;
            game.state.chart[game.quadrant.x][game.quadrant.y].starbase--;
            game.state.basekl++;
            newcnd();
            game.state.chart[game.quadrant.x][game.quadrant.y].starbase--;
            game.state.basekl++;
            newcnd();
@@ -322,7 +322,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
            crmena(true, iquad, sector, w);
            prout(_(" destroyed."));
            game.state.nplankl++;
            crmena(true, iquad, sector, w);
            prout(_(" destroyed."));
            game.state.nplankl++;
-           game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
+           q->planet = NOPLANET;
            DESTROY(&game.state.plnets[game.iplnet]);
            game.iplnet = 0;
            game.plnet.x = game.plnet.y = 0;
            DESTROY(&game.state.plnets[game.iplnet]);
            game.iplnet = 0;
            game.plnet.x = game.plnet.y = 0;
@@ -336,7 +336,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
            crmena(true, iquad, sector, w);
            prout(_(" destroyed."));
            game.state.nworldkl++;
            crmena(true, iquad, sector, w);
            prout(_(" destroyed."));
            game.state.nworldkl++;
-           game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
+           q->planet = NOPLANET;
            DESTROY(&game.state.plnets[game.iplnet]);
            game.iplnet = 0;
            game.plnet.x = game.plnet.y = 0;
            DESTROY(&game.state.plnets[game.iplnet]);
            game.iplnet = 0;
            game.plnet.x = game.plnet.y = 0;
@@ -373,8 +373,8 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
                 * you can shove the Thingy and piss it off.
                 * It then becomes an enemy and may fire at you.
                 */
                 * you can shove the Thingy and piss it off.
                 * It then becomes an enemy and may fire at you.
                 */
-               iqengry=1;
-               shoved=1;
+               iqengry = true;
+               shoved = true;
            }
            return;
        case IHBLANK: /* Black hole */
            }
            return;
        case IHBLANK: /* Black hole */
@@ -393,7 +393,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
            h1 = fabs(h1);
            if (h1 >= 600) {
                game.quad[w.x][w.y] = IHDOT;
            h1 = fabs(h1);
            if (h1 >= 600) {
                game.quad[w.x][w.y] = IHDOT;
-               game.ithere = 0;
+               game.ithere = false;
                game.tholian.x = game.tholian.y = 0;
                deadkl(w, iquad, w.x, w.y);
                return;
                game.tholian.x = game.tholian.y = 0;
                deadkl(w, iquad, w.x, w.y);
                return;
@@ -406,7 +406,8 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
            }
            prout(_(" disappears."));
            game.quad[w.x][w.y] = IHWEB;
            }
            prout(_(" disappears."));
            game.quad[w.x][w.y] = IHWEB;
-           game.ithere = game.tholian.x = game.tholian.y = 0;
+           game.ithere = false;
+           game.tholian.x = game.tholian.y = 0;
            game.nenhere--;
            {
                coord dummy;
            game.nenhere--;
            {
                coord dummy;
@@ -498,7 +499,7 @@ void attack(bool torps_ok)
        return;
     }
     if ((((game.comhere || game.ishere) && !game.justin) || game.skill == SKILL_EMERITUS) && torps_ok) movcom();
        return;
     }
     if ((((game.comhere || game.ishere) && !game.justin) || game.skill == SKILL_EMERITUS) && torps_ok) movcom();
-    if (game.nenhere==0 || (game.nenhere==1 && iqhere && iqengry==0)) return;
+    if (game.nenhere==0 || (game.nenhere==1 && iqhere && !iqengry)) return;
     pfac = 1.0/game.inshld;
     if (game.shldchg == 1) chgfac = 0.25+0.5*Rand();
     skip(1);
     pfac = 1.0/game.inshld;
     if (game.shldchg == 1) chgfac = 0.25+0.5*Rand();
     skip(1);
@@ -510,8 +511,7 @@ void attack(bool torps_ok)
        /* Increase chance of photon torpedos if docked or enemy energy low */
        if (game.condit == IHDOCKED) r *= 0.25;
        if (game.kpower[loop] < 500) r *= 0.25; 
        /* Increase chance of photon torpedos if docked or enemy energy low */
        if (game.condit == IHDOCKED) r *= 0.25;
        if (game.kpower[loop] < 500) r *= 0.25; 
-       jay.x = game.ks[loop].x;
-       jay.y = game.ks[loop].y;
+       jay = game.ks[loop];
        iquad = game.quad[jay.x][jay.y];
        if (iquad==IHT || (iquad==IHQUEST && !iqengry)) continue;
        itflag = (iquad == IHK && r > 0.0005) || !torps_ok ||
        iquad = game.quad[jay.x][jay.y];
        if (iquad==IHT || (iquad==IHQUEST && !iqengry)) continue;
        itflag = (iquad == IHK && r > 0.0005) || !torps_ok ||
@@ -641,11 +641,12 @@ void deadkl(coord w, int type, int ixx, int iyy)
     }
     else if (type == IHT) {
        /* Killed a Tholian */
     }
     else if (type == IHT) {
        /* Killed a Tholian */
-       game.ithere = 0;
+       game.ithere = false;
     }
     else if (type == IHQUEST) {
        /* Killed a Thingy */
     }
     else if (type == IHQUEST) {
        /* Killed a Thingy */
-       iqhere=iqengry=thing.x=thing.y=0;
+       iqhere = iqengry = false;
+       thing.x =thing.y = 0;
     }
     else {
        /* Some type of a Klingon */
     }
     else {
        /* Some type of a Klingon */
@@ -669,7 +670,8 @@ void deadkl(coord w, int type, int ixx, int iyy)
            break;
        case IHS:
            game.state.nscrem--;
            break;
        case IHS:
            game.state.nscrem--;
-           game.ishere = game.state.kscmdr.x = game.state.kscmdr.y = game.isatb = game.iscate = 0;
+           game.ishere = false;
+           game.state.kscmdr.x = game.state.kscmdr.y = game.isatb = game.iscate = 0;
            unschedule(FSCMOVE);
            unschedule(FSCDBAS);
            break;
            unschedule(FSCMOVE);
            unschedule(FSCDBAS);
            break;
@@ -731,7 +733,8 @@ void photon(void)
 {
     double targ[4][3], course[4];
     double r, dummy;
 {
     double targ[4][3], course[4];
     double r, dummy;
-    int key, n, i, osuabor;
+    int key, n, i;
+    bool osuabor;
 
     game.ididit = false;
 
 
     game.ididit = false;
 
@@ -824,7 +827,7 @@ void photon(void)
     }
     game.ididit = true;
     /* Loop for moving <n> torpedoes */
     }
     game.ididit = true;
     /* Loop for moving <n> torpedoes */
-    osuabor = 0;
+    osuabor = false;
     for (i = 1; i <= n && !osuabor; i++) {
        if (game.condit != IHDOCKED) game.torps--;
        r = (Rand()+Rand())*0.5 -0.5;
     for (i = 1; i <= n && !osuabor; i++) {
        if (game.condit != IHDOCKED) game.torps--;
        r = (Rand()+Rand())*0.5 -0.5;
@@ -838,7 +841,7 @@ void photon(void)
            skip(1);
            if (i < n)
                prout(_("  Remainder of burst aborted."));
            skip(1);
            if (i < n)
                prout(_("  Remainder of burst aborted."));
-           osuabor=1;
+           osuabor = true;
            if (Rand() <= 0.2) {
                prout(_("***Photon tubes damaged by misfire."));
                game.damage[DPHOTON] = game.damfac*(1.0+2.0*Rand());
            if (Rand() <= 0.2) {
                prout(_("***Photon tubes damaged by misfire."));
                game.damage[DPHOTON] = game.damfac*(1.0+2.0*Rand());
@@ -868,7 +871,7 @@ static void overheat(double rpow)
     }
 }
 
     }
 }
 
-static int checkshctrl(double rpow) 
+static bool checkshctrl(double rpow) 
 /* check shield control */
 {
     double hit;
 /* check shield control */
 {
     double hit;
@@ -877,7 +880,7 @@ static int checkshctrl(double rpow)
     skip(1);
     if (Rand() < .998) {
        prout(_("Shields lowered."));
     skip(1);
     if (Rand() < .998) {
        prout(_("Shields lowered."));
-       return 0;
+       return false;
     }
     /* Something bad has happened */
     prouts(_("***RED ALERT!  RED ALERT!"));
     }
     /* Something bad has happened */
     prouts(_("***RED ALERT!  RED ALERT!"));
@@ -890,7 +893,7 @@ static int checkshctrl(double rpow)
        skip(1);
        stars();
        finish(FPHASER);
        skip(1);
        stars();
        finish(FPHASER);
-       return 1;
+       return true;
     }
     prouts(_("Sulu-  \"Captain! Shield malfunction! Phaser fire contained!\""));
     skip(2);
     }
     prouts(_("Sulu-  \"Captain! Shield malfunction! Phaser fire contained!\""));
     skip(2);
@@ -909,7 +912,7 @@ static int checkshctrl(double rpow)
     prout(_("Phaser energy dispersed by shields."));
     prout(_("Enemy unaffected."));
     overheat(rpow);
     prout(_("Phaser energy dispersed by shields."));
     prout(_("Enemy unaffected."));
     overheat(rpow);
-    return 1;
+    return true;
 }
        
 
 }
        
 
@@ -918,13 +921,13 @@ void phasers(void)
 {
     double hits[21], rpow=0, extra, powrem, over, temp;
     int kz = 0, k=1, i, irec=0; /* Cheating inhibitor */
 {
     double hits[21], rpow=0, extra, powrem, over, temp;
     int kz = 0, k=1, i, irec=0; /* Cheating inhibitor */
-    int ifast=0, no=0, ipoop=1, msgflag = 1;
+    bool ifast = false, no = false, ipoop = true, msgflag = true;
     enum {NOTSET, MANUAL, FORCEMAN, AUTOMATIC} automode = NOTSET;
     int key=0;
 
     skip(1);
     /* SR sensors and Computer */
     enum {NOTSET, MANUAL, FORCEMAN, AUTOMATIC} automode = NOTSET;
     int key=0;
 
     skip(1);
     /* SR sensors and Computer */
-    if (damaged(DSRSENS) || damaged(DCOMPTR)) ipoop = 0;
+    if (damaged(DSRSENS) || damaged(DCOMPTR)) ipoop = false;
     if (game.condit == IHDOCKED) {
        prout(_("Phasers can't be fired through base shields."));
        chew();
     if (game.condit == IHDOCKED) {
        prout(_("Phasers can't be fired through base shields."));
        chew();
@@ -947,7 +950,7 @@ void phasers(void)
            return;
        }
        prout(_("Weapons Officer Sulu-  \"High-speed shield control enabled, sir.\""));
            return;
        }
        prout(_("Weapons Officer Sulu-  \"High-speed shield control enabled, sir.\""));
-       ifast = 1;
+       ifast = true;
                
     }
     /* Original code so convoluted, I re-did it all */
                
     }
     /* Original code so convoluted, I re-did it all */
@@ -978,7 +981,7 @@ void phasers(void)
                }
            }
            else if (isit("no")) {
                }
            }
            else if (isit("no")) {
-               no = 1;
+               no = true;
            }
            else {
                huh();
            }
            else {
                huh();
@@ -1011,7 +1014,7 @@ void phasers(void)
     switch (automode) {
     case AUTOMATIC:
        if (key == IHALPHA && isit("no")) {
     switch (automode) {
     case AUTOMATIC:
        if (key == IHALPHA && isit("no")) {
-           no = 1;
+           no = true;
            key = scan();
        }
        if (key != IHREAL && game.nenhere != 0) {
            key = scan();
        }
        if (key != IHREAL && game.nenhere != 0) {
@@ -1044,7 +1047,7 @@ void phasers(void)
            return;
        }
        if ((key=scan()) == IHALPHA && isit("no")) {
            return;
        }
        if ((key=scan()) == IHALPHA && isit("no")) {
-           no = 1;
+           no = true;
        }
        if (ifast) {
            game.energy -= 200; /* Go and do it! */
        }
        if (ifast) {
            game.energy -= 200; /* Go and do it! */
@@ -1071,7 +1074,7 @@ void phasers(void)
            hittem(hits);
            game.ididit = true;
        }
            hittem(hits);
            game.ididit = true;
        }
-       if (extra > 0 && game.alldone == 0) {
+       if (extra > 0 && !game.alldone) {
            if (game.ithere) {
                proutn(_("*** Tholian web absorbs "));
                if (game.nenhere>0) proutn(_("excess "));
            if (game.ithere) {
                proutn(_("*** Tholian web absorbs "));
                if (game.nenhere>0) proutn(_("excess "));
@@ -1106,7 +1109,7 @@ void phasers(void)
                proutn(_("Energy available= %.2f"),
                       game.energy-.006-(ifast?200:0));
                skip(1);
                proutn(_("Energy available= %.2f"),
                       game.energy-.006-(ifast?200:0));
                skip(1);
-               msgflag = 0;
+               msgflag = false;
                rpow = 0.0;
            }
            if (damaged(DSRSENS) && !(abs(game.sector.x-aim.x) < 2 && abs(game.sector.y-aim.y) < 2) &&
                rpow = 0.0;
            }
            if (damaged(DSRSENS) && !(abs(game.sector.x-aim.x) < 2 && abs(game.sector.y-aim.y) < 2) &&
@@ -1145,7 +1148,7 @@ void phasers(void)
            }
            if (key == IHEOL) {
                if (k==1) { /* Let me say I'm baffled by this */
            }
            if (key == IHEOL) {
                if (k==1) { /* Let me say I'm baffled by this */
-                   msgflag = 1;
+                   msgflag = true;
                }
                continue;
            }
                }
                continue;
            }
@@ -1172,7 +1175,7 @@ void phasers(void)
            return;
        }
        if (key == IHALPHA && isit("no")) {
            return;
        }
        if (key == IHALPHA && isit("no")) {
-           no = 1;
+           no = true;
        }
        game.energy -= rpow;
        chew();
        }
        game.energy -= rpow;
        chew();
@@ -1232,7 +1235,7 @@ void hittem(double *hits)
        else
            proutn(_("Very small hit on "));
        ienm = game.quad[w.x][w.y];
        else
            proutn(_("Very small hit on "));
        ienm = game.quad[w.x][w.y];
-       if (ienm==IHQUEST) iqengry=1;
+       if (ienm==IHQUEST) iqengry = true;
        crmena(false,ienm,sector,w);
        skip(1);
        if (kpow == 0) {
        crmena(false,ienm,sector,w);
        skip(1);
        if (kpow == 0) {
index d4eac3f688803d965e05a1c123bbbe3629b82046..95a3c44517c1e37650a296e2321a4dec87c1f765 100644 (file)
@@ -60,9 +60,9 @@ static bool cancelrest(void)
 void events(void) 
 /* run through the event queue looking for things to do */
 {
 void events(void) 
 /* run through the event queue looking for things to do */
 {
-    int istract=0, evcode, i=0, j, k, l;
+    int evcode, i=0, j, k, l;
     double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
     double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
-    bool radio_was_broken, ictbeam = false, ipage = false;
+    bool radio_was_broken, ictbeam = false, ipage = false, istract = false;
     struct quadrant *pdest, *q;
     coord w, hold;
     event *ev, *ev2;
     struct quadrant *pdest, *q;
     coord w, hold;
     event *ev, *ev2;
@@ -160,7 +160,7 @@ void events(void)
            break;
        case FSPY: /* Check with spy to see if S.C. should tractor beam */
            if (game.state.nscrem == 0 ||
            break;
        case FSPY: /* Check with spy to see if S.C. should tractor beam */
            if (game.state.nscrem == 0 ||
-               ictbeam+istract > 0 ||
+               ictbeam || istract ||
                game.condit==IHDOCKED || game.isatb==1 || game.iscate==1) return;
            if (game.ientesc ||
                (game.energy < 2000 && game.torps < 4 && game.shield < 1250) ||
                game.condit==IHDOCKED || game.isatb==1 || game.iscate==1) return;
            if (game.ientesc ||
                (game.energy < 2000 && game.torps < 4 && game.shield < 1250) ||
@@ -169,7 +169,7 @@ void events(void)
                 (game.energy < 2500 || damaged(DPHASER)) &&
                 (game.torps < 5 || damaged(DPHOTON)))) {
                /* Tractor-beam her! */
                 (game.energy < 2500 || damaged(DPHASER)) &&
                 (game.torps < 5 || damaged(DPHOTON)))) {
                /* Tractor-beam her! */
-               istract=1;
+               istract = true;
                yank = square(game.state.kscmdr.x-game.quadrant.x) + square(game.state.kscmdr.y-game.quadrant.y);
                /********* fall through to FTBEAM code ***********/
            }
                yank = square(game.state.kscmdr.x-game.quadrant.x) + square(game.state.kscmdr.y-game.quadrant.y);
                /********* fall through to FTBEAM code ***********/
            }
@@ -202,7 +202,7 @@ void events(void)
            /* If Kirk & Co. screwing around on planet, handle */
            atover(true); /* atover(true) is Grab */
            if (game.alldone) return;
            /* If Kirk & Co. screwing around on planet, handle */
            atover(true); /* atover(true) is Grab */
            if (game.alldone) return;
-           if (game.icraft == 1) { /* Caught in Galileo? */
+           if (game.icraft) { /* Caught in Galileo? */
                finish(FSTRACTOR);
                return;
            }
                finish(FSTRACTOR);
                return;
            }
@@ -363,9 +363,9 @@ void events(void)
            break;
        case FSCMOVE: /* Supercommander moves */
            schedule(FSCMOVE, 0.2777);
            break;
        case FSCMOVE: /* Supercommander moves */
            schedule(FSCMOVE, 0.2777);
-           if (game.ientesc+istract==0 &&
-               game.isatb != 1 &&
-               (game.iscate != 1 || !game.justin)) scom(&ipage);
+           if (!game.ientesc && !istract && game.isatb != 1 &&
+                       (game.iscate != 1 || !game.justin)) 
+               scom(&ipage);
            break;
        case FDSPROB: /* Move deep space probe */
            schedule(FDSPROB, 0.01);
            break;
        case FDSPROB: /* Move deep space probe */
            schedule(FDSPROB, 0.01);
index 2eed37c0846c5282d98a794d93ec554c0960821d..fd10f67a1a07e75ec254465f7174b99f7db3ba4d 100644 (file)
@@ -357,12 +357,12 @@ void shuttle(void)
            skip(1);
            prout(_("The short hop begins . . ."));
            game.state.plnets[game.iplnet].known=known;
            skip(1);
            prout(_("The short hop begins . . ."));
            game.state.plnets[game.iplnet].known=known;
-           game.icraft = 1;
+           game.icraft = true;
            skip(1);
            game.landed = -1;
            if (consumeTime()) return;
            game.iscraft = 1;
            skip(1);
            game.landed = -1;
            if (consumeTime()) return;
            game.iscraft = 1;
-           game.icraft = 0;
+           game.icraft = false;
            if (game.imine) {
                game.icrystl = 1;
                game.cryprob = 0.05;
            if (game.imine) {
                game.icrystl = 1;
                game.cryprob = 0.05;
@@ -380,12 +380,12 @@ void shuttle(void)
        skip(1);
        prouts(_("The hangar doors open; the trip begins."));
        skip(1);
        skip(1);
        prouts(_("The hangar doors open; the trip begins."));
        skip(1);
-       game.icraft = 1;
+       game.icraft = true;
        game.iscraft = 0;
        if (consumeTime()) return;
        game.state.plnets[game.iplnet].known = shuttle_down;
        game.landed = 1;
        game.iscraft = 0;
        if (consumeTime()) return;
        game.state.plnets[game.iplnet].known = shuttle_down;
        game.landed = 1;
-       game.icraft = 0;
+       game.icraft = false;
        prout(_("Trip complete"));
        return;
     }
        prout(_("Trip complete"));
        return;
     }
index d8f31c618c76c52a18250b9550e6aca5e41eda6d..7ea7c171f3374ba5dad7d6b7f8b8cd48eeeac2ea 100644 (file)
@@ -323,9 +323,9 @@ static void status(int req)
        break;
     case 10:
        if (game.options & OPTION_WORLDS) {
        break;
     case 10:
        if (game.options & OPTION_WORLDS) {
-           int here = game.state.galaxy[game.quadrant.x][game.quadrant.y].planet;
-           if (here != NOPLANET && game.state.plnets[here].inhabited != UNINHABITED)
-               proutn(_("Major system  %s"), systemname(here));
+           int plnet = game.state.galaxy[game.quadrant.x][game.quadrant.y].planet;
+           if (plnet != NOPLANET && game.state.plnets[plnet].inhabited != UNINHABITED)
+               proutn(_("Major system  %s"), systemname(plnet));
            else
                proutn(_("Sector is uninhabited"));
        }
            else
                proutn(_("Sector is uninhabited"));
        }
index 600afc43dbfb102494c113bb35469bc16249bf55..d464616f04714d21812b37364fa8c5e07f982d67 100644 (file)
@@ -253,8 +253,8 @@ void setup(bool needprompt)
     game.battle.x = game.battle.y = 0;
     game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0);
     game.nkinks = game.nhelp = game.casual = game.abandoned = 0;
     game.battle.x = game.battle.y = 0;
     game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0);
     game.nkinks = game.nhelp = game.casual = game.abandoned = 0;
-    game.resting = game.imine = false;
-    game.isatb = game.iscate = game.icrystl = game.icraft = game.state.nplankl = 0;
+    game.resting = game.imine = game.icraft = false;
+    game.isatb = game.iscate = game.icrystl = game.state.nplankl = 0;
     game.state.starkl = game.state.basekl = 0;
     game.iscraft = 1;
     game.landed = -1;
     game.state.starkl = game.state.basekl = 0;
     game.iscraft = 1;
     game.landed = -1;
@@ -595,7 +595,7 @@ void newqad(bool shutup)
 {
     int i, j;
     coord w;
 {
     int i, j;
     coord w;
-    struct quadrant *here;
+    struct quadrant *q;
 
     game.iattak = 1;
     game.justin = true;
 
     game.iattak = 1;
     game.justin = true;
@@ -603,39 +603,39 @@ void newqad(bool shutup)
     game.klhere = 0;
     game.comhere = 0;
     game.plnet.x = game.plnet.y = 0;
     game.klhere = 0;
     game.comhere = 0;
     game.plnet.x = game.plnet.y = 0;
-    game.ishere = 0;
+    game.ishere = false;
     game.irhere = 0;
     game.iplnet = 0;
     game.nenhere = 0;
     game.neutz = false;
     game.inorbit = false;
     game.landed = -1;
     game.irhere = 0;
     game.iplnet = 0;
     game.nenhere = 0;
     game.neutz = false;
     game.inorbit = false;
     game.landed = -1;
-    game.ientesc = 0;
-    game.ithere = 0;
-    iqhere=0;
-    iqengry=0;
+    game.ientesc = false;
+    game.ithere = false;
+    iqhere = false;
+    iqengry = false;
     game.iseenit = 0;
     if (game.iscate) {
        // Attempt to escape Super-commander, so tbeam back!
        game.iscate = 0;
     game.iseenit = 0;
     if (game.iscate) {
        // Attempt to escape Super-commander, so tbeam back!
        game.iscate = 0;
-       game.ientesc = 1;
+       game.ientesc = true;
     }
     // Clear quadrant
     for_sectors(i)
        for_sectors(j) 
            game.quad[i][j] = IHDOT;
     }
     // Clear quadrant
     for_sectors(i)
        for_sectors(j) 
            game.quad[i][j] = IHDOT;
-    here = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
+    q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
     // cope with supernova
     // cope with supernova
-    if (here->supernova)
+    if (q->supernova)
        return;
        return;
-    game.klhere = here->klingons;
-    game.irhere = here->romulans;
+    game.klhere = q->klingons;
+    game.irhere = q->romulans;
     game.nenhere = game.klhere + game.irhere;
 
     // Position Starship
     game.quad[game.sector.x][game.sector.y] = game.ship;
 
     game.nenhere = game.klhere + game.irhere;
 
     // Position Starship
     game.quad[game.sector.x][game.sector.y] = game.ship;
 
-    if (here->klingons) {
+    if (q->klingons) {
        // Position ordinary Klingons
        for (i = 1; i <= game.klhere; i++)
            newkling(i, &w);
        // Position ordinary Klingons
        for (i = 1; i <= game.klhere; i++)
            newkling(i, &w);
@@ -654,7 +654,7 @@ void newqad(bool shutup)
            game.quad[game.ks[1].x][game.ks[1].y] = IHS;
            game.kpower[1] = 1175.0 + 400.0*Rand() + 125.0*game.skill;
            game.iscate = game.state.remkl>1;
            game.quad[game.ks[1].x][game.ks[1].y] = IHS;
            game.kpower[1] = 1175.0 + 400.0*Rand() + 125.0*game.skill;
            game.iscate = game.state.remkl>1;
-           game.ishere = 1;
+           game.ishere = true;
        }
     }
     // Put in Romulans if needed
        }
     }
     // Put in Romulans if needed
@@ -665,13 +665,13 @@ void newqad(bool shutup)
        game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*game.skill;
     }
     // If quadrant needs a starbase, put it in
        game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*game.skill;
     }
     // If quadrant needs a starbase, put it in
-    if (here->starbase)
+    if (q->starbase)
        dropin(IHB, &game.base);
        
     // If quadrant needs a planet, put it in
        dropin(IHB, &game.base);
        
     // If quadrant needs a planet, put it in
-    if (here->planet != NOPLANET) {
-       game.iplnet = here->planet;
-       if (game.state.plnets[here->planet].inhabited == UNINHABITED)
+    if (q->planet != NOPLANET) {
+       game.iplnet = q->planet;
+       if (game.state.plnets[q->planet].inhabited == UNINHABITED)
            dropin(IHP, &game.plnet);
        else
            dropin(IHW, &game.plnet);
            dropin(IHP, &game.plnet);
        else
            dropin(IHW, &game.plnet);
@@ -679,11 +679,11 @@ void newqad(bool shutup)
     // Check for game.condition
     newcnd();
     // And finally the stars
     // Check for game.condition
     newcnd();
     // And finally the stars
-    for (i = 1; i <= here->stars; i++) 
+    for (i = 1; i <= q->stars; i++) 
        dropin(IHSTAR, &w);
 
     // Check for RNZ
        dropin(IHSTAR, &w);
 
     // Check for RNZ
-    if (game.irhere > 0 && game.klhere == 0 && (here->planet == NOPLANET || game.state.plnets[here->planet].inhabited == UNINHABITED)) {
+    if (game.irhere > 0 && game.klhere == 0 && (q->planet == NOPLANET || game.state.plnets[q->planet].inhabited == UNINHABITED)) {
        game.neutz = 1;
        if (!damaged(DRADIO)) {
            skip(1);
        game.neutz = 1;
        if (!damaged(DRADIO)) {
            skip(1);
@@ -725,7 +725,7 @@ void newqad(bool shutup)
                game.tholian.y = Rand() > 0.5 ? QUADSIZE : 1;
            } while (game.quad[game.tholian.x][game.tholian.y] != IHDOT);
            game.quad[game.tholian.x][game.tholian.y] = IHT;
                game.tholian.y = Rand() > 0.5 ? QUADSIZE : 1;
            } while (game.quad[game.tholian.x][game.tholian.y] != IHDOT);
            game.quad[game.tholian.x][game.tholian.y] = IHT;
-           game.ithere = 1;
+           game.ithere = true;
            game.nenhere++;
            game.ks[game.nenhere].x = game.tholian.x;
            game.ks[game.nenhere].y = game.tholian.y;
            game.nenhere++;
            game.ks[game.nenhere].x = game.tholian.x;
            game.ks[game.nenhere].y = game.tholian.y;
index 6d440f93d24bf809dfa0fbce078ea3de51a0c9de..16199e6df68ccb8acd5fd54b1fcf2ab7e4b7f966 100644 (file)
--- a/src/sst.c
+++ b/src/sst.c
@@ -175,7 +175,7 @@ static char line[128], *linep = line;
 
 struct game game;
 coord thing;
 
 struct game game;
 coord thing;
-int iqhere, iqengry;
+bool iqhere, iqengry;
 int iscore, iskill;    // Common PLAQ
 double aaitem;
 double perdate;
 int iscore, iskill;    // Common PLAQ
 double aaitem;
 double perdate;
index a1b8b5e00386dbc4b5fb48e0f29f52b23d97adcb..1c40d1b946d43a3e932b0814c363decca37f4e49 100644 (file)
--- a/src/sst.h
+++ b/src/sst.h
@@ -210,7 +210,11 @@ struct game {
        alive,          // we are alive (not killed)
        justin,         // just entered quadrant
        shldup,         // shields are up
        alive,          // we are alive (not killed)
        justin,         // just entered quadrant
        shldup,         // shields are up
+       ishere,         // super-commander in quadrant
+       ientesc,        // attempted escape from supercommander
+       ithere,         // Tholian is here 
        resting,        // rest time
        resting,        // rest time
+       icraft,         // Kirk in Galileo
        alldone,        // game is now finished
        neutz,          // Romulan Neutral Zone
        isarmed,        // probe is armed
        alldone,        // game is now finished
        neutz,          // Romulan Neutral Zone
        isarmed,        // probe is armed
@@ -240,17 +244,13 @@ struct game {
        iplnet,         // planet # in quadrant
        inplan,         // initial planets
        nenhere,        // number of enemies in quadrant
        iplnet,         // planet # in quadrant
        inplan,         // initial planets
        nenhere,        // number of enemies in quadrant
-       ishere,         // super-commander in quandrant
        irhere,         // Romulans in quadrant
        irhere,         // Romulans in quadrant
-       icraft,         // Kirk in Galileo
-       ientesc,        // attempted escape from supercommander
        iscraft,        // =1 if craft on ship, -1 if removed from game
        isatb,          // =1 if super commander is attacking base
        iscate,         // super commander is here
        iattak,         // attack recursion elimination (was cracks[4])
        icrystl,        // dilithium crystals aboard
        tourn,          // tournament number
        iscraft,        // =1 if craft on ship, -1 if removed from game
        isatb,          // =1 if super commander is attacking base
        iscate,         // super commander is here
        iattak,         // attack recursion elimination (was cracks[4])
        icrystl,        // dilithium crystals aboard
        tourn,          // tournament number
-       ithere,         // Tholian is here 
        iseenit,        // seen base attack report
        proben,         // number of moves for probe
        nprobes;        // number of probes available
        iseenit,        // seen base attack report
        proben,         // number of moves for probe
        nprobes;        // number of probes available
@@ -292,7 +292,7 @@ extern FILE *logfp, *replayfp;
 
 /* the Space Thingy's global state should *not* be saved! */
 extern coord thing;
 
 /* the Space Thingy's global state should *not* be saved! */
 extern coord thing;
-extern int iqhere, iqengry;
+extern bool iqhere, iqengry;
 
 typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE,
               FNEG3, FNOVA, FSNOVAED, FABANDN, FDILITHIUM,
 
 typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE,
               FNEG3, FNOVA, FSNOVAED, FABANDN, FDILITHIUM,