From fec5bf04131385b55dc3b0ad9c7d8d245a7d07da Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 19 Sep 2006 19:20:43 +0000 Subject: [PATCH] Avoid a nasty bug in planet-name display, and fix another boolean. --- src/events.c | 2 +- src/moving.c | 6 +++--- src/planets.c | 12 +++++++----- src/setup.c | 13 ++++++------- src/sst.h | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/events.c b/src/events.c index 9954401..5f1c600 100644 --- a/src/events.c +++ b/src/events.c @@ -238,7 +238,7 @@ void events(void) } else prout(_("(Shields not currently useable.)")); } - newqad(0); + newqad(false); /* Adjust finish time to time of tractor beaming */ fintim = game.state.date+game.optime; attack(0); diff --git a/src/moving.c b/src/moving.c index 126d3ba..4908236 100644 --- a/src/moving.c +++ b/src/moving.c @@ -113,7 +113,7 @@ void imove(void) skip(1); prout(_("Entering %s."), cramlc(quadrant, game.quadrant)); game.quad[game.sector.x][game.sector.y] = game.ship; - newqad(0); + newqad(false); if (game.skill>SKILL_NOVICE) attack(0); return; } @@ -824,7 +824,7 @@ void timwrp() postpone(FTBEAM, game.optime); game.damage[DRADIO] += game.optime; } - newqad(0); + newqad(false); events(); /* Stas Sergeev added this -- do pending events */ } @@ -943,7 +943,7 @@ void mayday(void) } /* Since starbase not in quadrant, set up new quadrant */ game.quadrant = game.state.baseq[line]; - newqad(1); + newqad(true); } /* dematerialize starship */ game.quad[game.sector.x][game.sector.y]=IHDOT; diff --git a/src/planets.c b/src/planets.c index dd04b62..8d387af 100644 --- a/src/planets.c +++ b/src/planets.c @@ -512,9 +512,10 @@ void deathray(void) char *systemname(int pindx) { - /* the below array shoud not be static, or it won't gettextize + static char copy[BUFSIZ]; + /* the below array should not be static, or it won't gettextize * because of the early initialization. */ - char *names[NINHAB] = + char *names[NINHAB+1] = { /* * I used to find planets @@ -553,7 +554,7 @@ char *systemname(int pindx) _("Marcos XII"), /* TOS: "And the Children Shall Lead", */ _("Omega IV"), /* TOS: "The Omega Glory" */ _("Regulus V"), /* TOS: "Amok Time */ - _("Deeva"), /* TOS: "Operation -- Annihilate!" */ + _("Deneva"), /* TOS: "Operation -- Annihilate!" */ /* Worlds from BSD Trek */ _("Rigel II"), /* TOS: "Shore Leave" ("III" in BSD) */ _("Beta III"), /* TOS: "The Return of the Archons" */ @@ -570,7 +571,8 @@ char *systemname(int pindx) _("Coridan (Desotriana)"), /* TOS: "Journey to Babel" */ _("Iotia"), /* TOS: "A Piece of the Action" */ #endif - }; + }; - return names[pindx]; + strcpy(copy, names[pindx]); + return copy; } diff --git a/src/setup.c b/src/setup.c index 812a6c1..e56e1e3 100644 --- a/src/setup.c +++ b/src/setup.c @@ -181,11 +181,10 @@ void abandn(void) prout("the Federation in a prisoner-of-war exchange."); nb = Rand()*game.state.rembase+1; /* Set up quadrant and position FQ adjacient to base */ - if (game.quadrant.x!=game.state.baseq[nb].x || game.quadrant.y!=game.state.baseq[nb].y) { - game.quadrant.x = game.state.baseq[nb].x; - game.quadrant.y = game.state.baseq[nb].y; + if (!same(game.quadrant, game.state.baseq[nb])) { + game.quadrant = game.state.baseq[nb]; game.sector.x = game.sector.y = 5; - newqad(1); + newqad(true); } for (;;) { /* position next to base by trial and error */ @@ -199,7 +198,7 @@ void abandn(void) if (l < QUADSIZE+1) break; /* found a spot */ game.sector.x=QUADSIZE/2; game.sector.y=QUADSIZE/2; - newqad(1); + newqad(true); } } /* Get new commission */ @@ -450,7 +449,7 @@ void setup(int needprompt) prout("Good Luck!"); if (game.state.nscrem) prout(" YOU'LL NEED IT."); waitfor(); - newqad(0); + newqad(false); if (game.nenhere-iqhere-game.ithere) game.shldup = true; if (game.neutz) attack(0); // bad luck to start in a Romulan Neutral Zone } @@ -592,7 +591,7 @@ void newkling(int i, coord *pi) game.kpower[i] = Rand()*150.0 +300.0 +25.0*game.skill; } -void newqad(int shutup) +void newqad(bool shutup) { int i, j; coord w; diff --git a/src/sst.h b/src/sst.h index 8651afd..27040e8 100644 --- a/src/sst.h +++ b/src/sst.h @@ -367,7 +367,7 @@ void skip(int); void prout(char *, ...); void proutn(char *, ...); void stars(void); -void newqad(int); +void newqad(bool); bool ja(void); void cramen(int); void crmshp(void); -- 2.31.1