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