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 the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 */ 17 18 #ifndef lint 19 static char sccsid[] = "@(#)lrscan.c 5.3 (Berkeley) 06/18/88"; 20 #endif /* not lint */ 21 22 # include "trek.h" 23 24 /* 25 ** LONG RANGE OF SCANNERS 26 ** 27 ** A summary of the quadrants that surround you is printed. The 28 ** hundreds digit is the number of Klingons in the quadrant, 29 ** the tens digit is the number of starbases, and the units digit 30 ** is the number of stars. If the printout is "///" it means 31 ** that that quadrant is rendered uninhabitable by a supernova. 32 ** It also updates the "scanned" field of the quadrants it scans, 33 ** for future use by the "chart" option of the computer. 34 */ 35 36 lrscan() 37 { 38 register int i, j; 39 register struct quad *q; 40 41 if (check_out(LRSCAN)) 42 { 43 return; 44 } 45 printf("Long range scan for quadrant %d,%d\n\n", Ship.quadx, Ship.quady); 46 47 /* print the header on top */ 48 for (j = Ship.quady - 1; j <= Ship.quady + 1; j++) 49 { 50 if (j < 0 || j >= NQUADS) 51 printf(" "); 52 else 53 printf(" %1d", j); 54 } 55 56 /* scan the quadrants */ 57 for (i = Ship.quadx - 1; i <= Ship.quadx + 1; i++) 58 { 59 printf("\n -------------------\n"); 60 if (i < 0 || i >= NQUADS) 61 { 62 /* negative energy barrier */ 63 printf(" ! * ! * ! * !"); 64 continue; 65 } 66 67 /* print the left hand margin */ 68 printf("%1d !", i); 69 for (j = Ship.quady - 1; j <= Ship.quady + 1; j++) 70 { 71 if (j < 0 || j >= NQUADS) 72 { 73 /* negative energy barrier again */ 74 printf(" * !"); 75 continue; 76 } 77 q = &Quad[i][j]; 78 if (q->stars < 0) 79 { 80 /* supernova */ 81 printf(" /// !"); 82 q->scanned = 1000; 83 continue; 84 } 85 q->scanned = q->klings * 100 + q->bases * 10 + q->stars; 86 printf(" %3d !", q->scanned); 87 } 88 } 89 printf("\n -------------------\n"); 90 return; 91 } 92