lrscan.c
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 75 行
C
75 行
#ifndef lintstatic char sccsid[] = "@(#)lrscan.c 4.1 (Berkeley) 3/23/83";#endif not lint# include "trek.h"/*** LONG RANGE OF SCANNERS**** A summary of the quadrants that surround you is printed. The** hundreds digit is the number of Klingons in the quadrant,** the tens digit is the number of starbases, and the units digit** is the number of stars. If the printout is "///" it means** that that quadrant is rendered uninhabitable by a supernova.** It also updates the "scanned" field of the quadrants it scans,** for future use by the "chart" option of the computer.*/lrscan(){ register int i, j; register struct quad *q; if (check_out(LRSCAN)) { return; } printf("Long range scan for quadrant %d,%d\n\n", Ship.quadx, Ship.quady); /* print the header on top */ for (j = Ship.quady - 1; j <= Ship.quady + 1; j++) { if (j < 0 || j >= NQUADS) printf(" "); else printf(" %1d", j); } /* scan the quadrants */ for (i = Ship.quadx - 1; i <= Ship.quadx + 1; i++) { printf("\n -------------------\n"); if (i < 0 || i >= NQUADS) { /* negative energy barrier */ printf(" ! * ! * ! * !"); continue; } /* print the left hand margin */ printf("%1d !", i); for (j = Ship.quady - 1; j <= Ship.quady + 1; j++) { if (j < 0 || j >= NQUADS) { /* negative energy barrier again */ printf(" * !"); continue; } q = &Quad[i][j]; if (q->stars < 0) { /* supernova */ printf(" /// !"); q->scanned = 1000; continue; } q->scanned = q->klings * 100 + q->bases * 10 + q->stars; printf(" %3d !", q->scanned); } } printf("\n -------------------\n"); return;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?