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