From: Eric S. Raymond Date: Wed, 20 Sep 2006 16:29:48 +0000 (+0000) Subject: Incorporate BSD-Trek visual-scan code, just in case. X-Git-Tag: 2.0~213 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=0def1139fe1c02cd25c21fe26c9a9722debf4211;p=super-star-trek.git Incorporate BSD-Trek visual-scan code, just in case. --- diff --git a/TODO b/TODO index 19769b0..e5a3b22 100644 --- a/TODO +++ b/TODO @@ -24,12 +24,9 @@ BSD-Trek features we haven't swiped yet: * Summoning Klingons to surrender and taking captives. -* Automatic bugout sets your warp factor to > 6. - * Smarter computer, with multiple requests. * There is a small probility that a nova event will leave a black hole. * Multiple laser banks and beam spreading. -* Visual scans for when sensors are out. diff --git a/doc/sst-doc.xml b/doc/sst-doc.xml index ef76268..5807be7 100644 --- a/doc/sst-doc.xml +++ b/doc/sst-doc.xml @@ -411,6 +411,21 @@ short-range scan anytime you like. the contents of adjacent sectors. + Status Report diff --git a/src/reports.c b/src/reports.c index 90b9faf..39fcf36 100644 --- a/src/reports.c +++ b/src/reports.c @@ -557,3 +557,74 @@ void eta(void) } } + +#if BSD_BUG_FOR_BUG +/* + * A visual scan is made in a particular direction of three sectors + * in the general direction specified. This takes time, and + * Klingons can attack you, so it should be done only when sensors + * are out. Code swiped from BSD-Trek. Not presently used, as we + * automatically display all adjacent sectors on the short-range + * scan even when short-range sensors are out. + */ + +/* This struct[] has the delta x, delta y for particular directions */ +coord visdelta[] = +{ + {-1,-1}, + {-1, 0}, + {-1, 1}, + {0, 1}, + {1, 1}, + {1, 0}, + {1, -1}, + {0, -1}, + {-1,-1}, + {-1, 0}, + {-1, 1}, +}; + +void visual(void) +{ + int co, ix, iy; + coord *v; + + if (scan() != IHREAL) { + chew(); + proutn(_("Direction? ")); + if (scan()!=IHREAL) { + huh(); + return; + } + } + if (aaitem < 0.0 || aaitem > 360.0) + return; + co = (aaitem + 22) / 45; + v = &visdelta[co]; + ix = game.sector.x + v->x; + iy = game.sector.y + v->y; + if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE) + co = '?'; + else + co = game.quad[ix][iy]; + printf("%d,%d %c ", ix, iy, co); + v++; + ix = game.sector.x + v->x; + iy = game.sector.y + v->y; + if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE) + co = '?'; + else + co = game.quad[ix][iy]; + printf("%c ", co); + v++; + ix = game.sector.x + v->x; + iy = game.sector.y + v->y; + if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE) + co = '?'; + else + co = game.quad[ix][iy]; + printf("%c %d,%d\n", co, ix, iy); + game.optime = 0.5; + game.ididit = true; +} +#endif diff --git a/src/sst.c b/src/sst.c index d196984..0ae5598 100644 --- a/src/sst.c +++ b/src/sst.c @@ -291,6 +291,10 @@ commands[] = { {"HELP", HELP, 0}, #define SEED 37 {"SEED", SEED, 0}, +#if BSD_BUG_FOR_BUG +#define VISUAL 38 + {"VISUAL", VISUAL, 0}, +#endif }; #define NUMCOMMANDS sizeof(commands)/sizeof(commands[0]) @@ -572,6 +576,11 @@ static void makemoves(void) if (key == IHREAL) seed = (int)aaitem; break; +#if BSD_BUG_FOR_BUG + case VISUAL: + visual(); // perform visual scan + break; +#endif } commandhook(commands[i].name, false); for (;;) { diff --git a/src/sst.h b/src/sst.h index 344ddcb..c7a146d 100644 --- a/src/sst.h +++ b/src/sst.h @@ -438,6 +438,9 @@ void makechart(void); void enqueue(char *); char *systemname(int); coord newkling(int); +#if BSD_BUG_FOR_BUG +void visual(void); +#endif extern WINDOW *curwnd; extern WINDOW *fullscreen_window;