xref: /csrg-svn/games/trek/lrscan.c (revision 60857)
121284Sdist /*
2*60857Sbostic  * Copyright (c) 1980, 1993
3*60857Sbostic  *	The Regents of the University of California.  All rights reserved.
434205Sbostic  *
542606Sbostic  * %sccs.include.redist.c%
621284Sdist  */
721284Sdist 
811682Smckusick #ifndef lint
9*60857Sbostic static char sccsid[] = "@(#)lrscan.c	8.1 (Berkeley) 05/31/93";
1034205Sbostic #endif /* not lint */
1111682Smckusick 
1211682Smckusick # include	"trek.h"
1311682Smckusick 
1411682Smckusick /*
1511682Smckusick **  LONG RANGE OF SCANNERS
1611682Smckusick **
1711682Smckusick **	A summary of the quadrants that surround you is printed.  The
1811682Smckusick **	hundreds digit is the number of Klingons in the quadrant,
1911682Smckusick **	the tens digit is the number of starbases, and the units digit
2011682Smckusick **	is the number of stars.  If the printout is "///" it means
2111682Smckusick **	that that quadrant is rendered uninhabitable by a supernova.
2211682Smckusick **	It also updates the "scanned" field of the quadrants it scans,
2311682Smckusick **	for future use by the "chart" option of the computer.
2411682Smckusick */
2511682Smckusick 
lrscan()2611682Smckusick lrscan()
2711682Smckusick {
2811682Smckusick 	register int			i, j;
2911682Smckusick 	register struct quad		*q;
3011682Smckusick 
3111682Smckusick 	if (check_out(LRSCAN))
3211682Smckusick 	{
3311682Smckusick 		return;
3411682Smckusick 	}
3511682Smckusick 	printf("Long range scan for quadrant %d,%d\n\n", Ship.quadx, Ship.quady);
3611682Smckusick 
3711682Smckusick 	/* print the header on top */
3811682Smckusick 	for (j = Ship.quady - 1; j <= Ship.quady + 1; j++)
3911682Smckusick 	{
4011682Smckusick 		if (j < 0 || j >= NQUADS)
4111682Smckusick 			printf("      ");
4211682Smckusick 		else
4311682Smckusick 			printf("     %1d", j);
4411682Smckusick 	}
4511682Smckusick 
4611682Smckusick 	/* scan the quadrants */
4711682Smckusick 	for (i = Ship.quadx - 1; i <= Ship.quadx + 1; i++)
4811682Smckusick 	{
4911682Smckusick 		printf("\n  -------------------\n");
5011682Smckusick 		if (i < 0 || i >= NQUADS)
5111682Smckusick 		{
5211682Smckusick 			/* negative energy barrier */
5311682Smckusick 			printf("  !  *  !  *  !  *  !");
5411682Smckusick 			continue;
5511682Smckusick 		}
5611682Smckusick 
5711682Smckusick 		/* print the left hand margin */
5811682Smckusick 		printf("%1d !", i);
5911682Smckusick 		for (j = Ship.quady - 1; j <= Ship.quady + 1; j++)
6011682Smckusick 		{
6111682Smckusick 			if (j < 0 || j >= NQUADS)
6211682Smckusick 			{
6311682Smckusick 				/* negative energy barrier again */
6411682Smckusick 				printf("  *  !");
6511682Smckusick 				continue;
6611682Smckusick 			}
6711682Smckusick 			q = &Quad[i][j];
6811682Smckusick 			if (q->stars < 0)
6911682Smckusick 			{
7011682Smckusick 				/* supernova */
7111682Smckusick 				printf(" /// !");
7211682Smckusick 				q->scanned = 1000;
7311682Smckusick 				continue;
7411682Smckusick 			}
7511682Smckusick 			q->scanned = q->klings * 100 + q->bases * 10 + q->stars;
7611682Smckusick 			printf(" %3d !", q->scanned);
7711682Smckusick 		}
7811682Smckusick 	}
7911682Smckusick 	printf("\n  -------------------\n");
8011682Smckusick 	return;
8111682Smckusick }
82