Annotation of 42BSD/games/trek/lrscan.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char sccsid[] = "@(#)lrscan.c   4.1     (Berkeley)      3/23/83";
        !             3: #endif not lint
        !             4: 
        !             5: # include      "trek.h"
        !             6: 
        !             7: /*
        !             8: **  LONG RANGE OF SCANNERS
        !             9: **
        !            10: **     A summary of the quadrants that surround you is printed.  The
        !            11: **     hundreds digit is the number of Klingons in the quadrant,
        !            12: **     the tens digit is the number of starbases, and the units digit
        !            13: **     is the number of stars.  If the printout is "///" it means
        !            14: **     that that quadrant is rendered uninhabitable by a supernova.
        !            15: **     It also updates the "scanned" field of the quadrants it scans,
        !            16: **     for future use by the "chart" option of the computer.
        !            17: */
        !            18: 
        !            19: lrscan()
        !            20: {
        !            21:        register int                    i, j;
        !            22:        register struct quad            *q;
        !            23: 
        !            24:        if (check_out(LRSCAN))
        !            25:        {
        !            26:                return;
        !            27:        }
        !            28:        printf("Long range scan for quadrant %d,%d\n\n", Ship.quadx, Ship.quady);
        !            29: 
        !            30:        /* print the header on top */
        !            31:        for (j = Ship.quady - 1; j <= Ship.quady + 1; j++)
        !            32:        {
        !            33:                if (j < 0 || j >= NQUADS)
        !            34:                        printf("      ");
        !            35:                else
        !            36:                        printf("     %1d", j);
        !            37:        }
        !            38: 
        !            39:        /* scan the quadrants */
        !            40:        for (i = Ship.quadx - 1; i <= Ship.quadx + 1; i++)
        !            41:        {
        !            42:                printf("\n  -------------------\n");
        !            43:                if (i < 0 || i >= NQUADS)
        !            44:                {
        !            45:                        /* negative energy barrier */
        !            46:                        printf("  !  *  !  *  !  *  !");
        !            47:                        continue;
        !            48:                }
        !            49: 
        !            50:                /* print the left hand margin */
        !            51:                printf("%1d !", i);
        !            52:                for (j = Ship.quady - 1; j <= Ship.quady + 1; j++)
        !            53:                {
        !            54:                        if (j < 0 || j >= NQUADS)
        !            55:                        {
        !            56:                                /* negative energy barrier again */
        !            57:                                printf("  *  !");
        !            58:                                continue;
        !            59:                        }
        !            60:                        q = &Quad[i][j];
        !            61:                        if (q->stars < 0)
        !            62:                        {
        !            63:                                /* supernova */
        !            64:                                printf(" /// !");
        !            65:                                q->scanned = 1000;
        !            66:                                continue;
        !            67:                        }
        !            68:                        q->scanned = q->klings * 100 + q->bases * 10 + q->stars;
        !            69:                        printf(" %3d !", q->scanned);
        !            70:                }
        !            71:        }
        !            72:        printf("\n  -------------------\n");
        !            73:        return;
        !            74: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.