From: Eric S. Raymond Date: Fri, 29 Sep 2006 07:59:45 +0000 (+0000) Subject: Get rid of DESTROY macro. X-Git-Tag: 2.0~183 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=2c5438d3c22fe863ad8054d214f2afdd061ad43a;p=super-star-trek.git Get rid of DESTROY macro. --- diff --git a/src/ai.c b/src/ai.c index 7f0112d..31d19ad 100644 --- 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); diff --git a/src/battle.c b/src/battle.c index 8f45cfb..d9e8154 100644 --- a/src/battle.c +++ b/src/battle.c @@ -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; diff --git a/src/events.c b/src/events.c index aeefdb4..b4b6121 100644 --- a/src/events.c +++ b/src/events.c @@ -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 */ diff --git a/src/planets.c b/src/planets.c index 5f31e5d..8aba37c 100644 --- a/src/planets.c +++ b/src/planets.c @@ -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) "); diff --git a/src/sst.h b/src/sst.h index 63a9679..7389c5d 100644 --- 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',