1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char sccsid[] = "@(#)lrscan.c	5.1 (Berkeley) 5/30/85";
   9: #endif not lint
  10: 
  11: # include   "trek.h"
  12: 
  13: /*
  14: **  LONG RANGE OF SCANNERS
  15: **
  16: **	A summary of the quadrants that surround you is printed.  The
  17: **	hundreds digit is the number of Klingons in the quadrant,
  18: **	the tens digit is the number of starbases, and the units digit
  19: **	is the number of stars.  If the printout is "///" it means
  20: **	that that quadrant is rendered uninhabitable by a supernova.
  21: **	It also updates the "scanned" field of the quadrants it scans,
  22: **	for future use by the "chart" option of the computer.
  23: */
  24: 
  25: lrscan()
  26: {
  27:     register int            i, j;
  28:     register struct quad        *q;
  29: 
  30:     if (check_out(LRSCAN))
  31:     {
  32:         return;
  33:     }
  34:     printf("Long range scan for quadrant %d,%d\n\n", Ship.quadx, Ship.quady);
  35: 
  36:     /* print the header on top */
  37:     for (j = Ship.quady - 1; j <= Ship.quady + 1; j++)
  38:     {
  39:         if (j < 0 || j >= NQUADS)
  40:             printf("      ");
  41:         else
  42:             printf("     %1d", j);
  43:     }
  44: 
  45:     /* scan the quadrants */
  46:     for (i = Ship.quadx - 1; i <= Ship.quadx + 1; i++)
  47:     {
  48:         printf("\n  -------------------\n");
  49:         if (i < 0 || i >= NQUADS)
  50:         {
  51:             /* negative energy barrier */
  52:             printf("  !  *  !  *  !  *  !");
  53:             continue;
  54:         }
  55: 
  56:         /* print the left hand margin */
  57:         printf("%1d !", i);
  58:         for (j = Ship.quady - 1; j <= Ship.quady + 1; j++)
  59:         {
  60:             if (j < 0 || j >= NQUADS)
  61:             {
  62:                 /* negative energy barrier again */
  63:                 printf("  *  !");
  64:                 continue;
  65:             }
  66:             q = &Quad[i][j];
  67:             if (q->stars < 0)
  68:             {
  69:                 /* supernova */
  70:                 printf(" /// !");
  71:                 q->scanned = 1000;
  72:                 continue;
  73:             }
  74:             q->scanned = q->klings * 100 + q->bases * 10 + q->stars;
  75:             printf(" %3d !", q->scanned);
  76:         }
  77:     }
  78:     printf("\n  -------------------\n");
  79:     return;
  80: }

Defined functions

lrscan defined in line 25; used 2 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-05-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 972
Valid CSS Valid XHTML 1.0 Strict