Get rid of DESTROY macro.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 29 Sep 2006 07:59:45 +0000 (07:59 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 29 Sep 2006 07:59:45 +0000 (07:59 +0000)
src/ai.c
src/battle.c
src/events.c
src/planets.c
src/sst.h

index 7f0112d5f957912ad9820a1bdb1e71d2a2838d1a..31d19ad13bdcf06293ab473679a9abfc09a817a5 100644 (file)
--- a/src/ai.c
+++ b/src/ai.c
@@ -360,7 +360,7 @@ static bool movescom(coord iq, bool avoid)
        if (same(game.state.planets[i].w, game.state.kscmdr) &&
            game.state.planets[i].crystals == present) {
            /* destroy the planet */
-           DESTROY(&game.state.planets[i]);
+           game.state.planets[i].pclass = destroyed;
            game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = NOPLANET;
            if (!damaged(DRADIO) || game.condition == docked) {
                pause_game(true);
index 8f45cfbcf682f4a44568a23d08953d331d454082..d9e815436c0fa415b1e7bd9df81287c5575c5919 100644 (file)
@@ -399,7 +399,7 @@ void torpedo(double course, double r, coord in, double *hit, int i, int n)
            prout(_(" destroyed."));
            game.state.nplankl++;
            q->planet = NOPLANET;
-           DESTROY(&game.state.planets[game.iplnet]);
+           game.state.planets[game.iplnet].pclass = destroyed;
            game.iplnet = 0;
            invalidate(game.plnet);
            game.quad[w.x][w.y] = IHDOT;
@@ -413,7 +413,7 @@ void torpedo(double course, double r, coord in, double *hit, int i, int n)
            prout(_(" destroyed."));
            game.state.nworldkl++;
            q->planet = NOPLANET;
-           DESTROY(&game.state.planets[game.iplnet]);
+           game.state.planets[game.iplnet].pclass = destroyed;
            game.iplnet = 0;
            invalidate(game.plnet);
            game.quad[w.x][w.y] = IHDOT;
index aeefdb49c8fdddbcc4d4b76d39e5d2c67567c9a8..b4b61214b14cecd18efcb09c2c836c9b7c9aa153 100644 (file)
@@ -689,7 +689,7 @@ void nova(coord nov)
                        game.state.nplankl++;
                        crmena(true, IHP, sector, scratch);
                        prout(_(" destroyed."));
-                       DESTROY(&game.state.planets[game.iplnet]);
+                       game.state.planets[game.iplnet].pclass = destroyed;
                        game.iplnet = 0;
                        invalidate(game.plnet);
                        if (game.landed) {
@@ -919,7 +919,7 @@ void supernova(bool induced, coord *w)
        int loop;
        for (loop = 0; loop < game.inplan; loop++)
            if (same(game.state.planets[loop].w, nq)) {
-               DESTROY(&game.state.planets[loop]);
+               game.state.planets[loop].pclass = destroyed;
            }
     }
     /* Destroy any base in supernovaed quadrant */
index 5f31e5de8dcb809b865d47bf1d19fa7c8b4d6338..8aba37c3f07288916d68f16720169a55c591169f 100644 (file)
@@ -22,10 +22,11 @@ void survey(void)
     prout(_("Spock-  \"Planet report follows, Captain.\""));
     skip(1);
     for (i = 0; i < game.inplan; i++) {
+       if (game.state.planets[i].pclass == destroyed)
+           continue;
        if ((game.state.planets[i].known != unknown
-           && game.state.planets[i].inhabited == UNINHABITED)
-           || (idebug && game.state.planets[i].w.x !=0)
-           ) {
+            && game.state.planets[i].inhabited == UNINHABITED)
+           || idebug) {
            iknow = true;
            if (idebug && game.state.planets[i].known==unknown)
                proutn("(Unknown) ");
index 63a967996edbfced2e5fff75f2bf8fb8eb92a226..7389c5de3aecd4a0c3636b88c172849e9a4d9ea1 100644 (file)
--- a/src/sst.h
+++ b/src/sst.h
@@ -47,15 +47,13 @@ typedef struct {int x; int y;} coord;
 
 typedef struct {
     coord w;
-    enum {M=0, N=1, O=2} pclass;
+    enum {destroyed= -1, M=0, N=1, O=2} pclass;
     int inhabited;     /* if NZ, an index into a name array */
 #define UNINHABITED    -1
     enum {mined=-1, present=0, absent=1} crystals; /* has crystals */
     enum {unknown, known, shuttle_down} known;
 } planet;
 
-#define DESTROY(pl)    memset(pl, '\0', sizeof(planet))
-
 typedef enum {
     IHR = 'R',
     IHK = 'K',