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