Incorporate BSD-Trek visual-scan code, just in case.
[super-star-trek.git] / src / reports.c
index 6120d02f40d6bb85828612b62c48b1b4ac8b1430..39fcf36cbed4df92796eb802f3db2b304390536d 100644 (file)
@@ -337,7 +337,7 @@ static void status(int req)
     }
 }
                
-int srscan(int l)
+void srscan(scantype type)
 /* short-range scan */
 {
     /* the "sy" request is undocumented */
@@ -346,7 +346,7 @@ int srscan(int l)
     
     int i, j, jj, req=0;
     int goodScan=true, leftside=true, rightside=true, title=false; 
-    switch (l) {
+    switch (type) {
     case SCAN_FULL: // SRSCAN
        if (damaged(DSRSENS)) {
            /* Allow base's sensors if docked */
@@ -381,7 +381,7 @@ int srscan(int l)
            prout(_("UNRECOGNIZED REQUEST. Legal requests are:"));
            prout(_("  date, condition, position, lsupport, warpfactor,"));
            prout(_("  energy, torpedoes, shields, klingons, time, system, bases."));
-           return false;
+           return;
        }
        // no break
     case SCAN_STATUS: // STATUS
@@ -405,11 +405,10 @@ int srscan(int l)
        if (rightside)
            status(jj);
        if (i<sizeof(requests)/sizeof(requests[0])) skip(1);
-       if (req!=0) return(goodScan);
+       if (req!=0) return;
     }
     prout("");
     if (title) chart(true);
-    return(goodScan);
 }
                        
                        
@@ -558,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