Commit | Line | Data |
---|---|---|
b6f0a7e4 DF |
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 | ||
1ee78caa | 7 | #ifndef lint |
b6f0a7e4 | 8 | static char sccsid[] = "@(#)lrscan.c 5.1 (Berkeley) %G%"; |
1ee78caa KM |
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 | } |