Annotation of 43BSD/games/trek/win.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1980 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  */
        !             6: 
        !             7: #ifndef lint
        !             8: static char sccsid[] = "@(#)win.c      5.1 (Berkeley) 5/30/85";
        !             9: #endif not lint
        !            10: 
        !            11: # include      "trek.h"
        !            12: # include      "getpar.h"
        !            13: 
        !            14: /*
        !            15: **  Signal game won
        !            16: **
        !            17: **     This routine prints out the win message, arranges to print out
        !            18: **     your score, tells you if you have a promotion coming to you,
        !            19: **     cleans up the current input line, and arranges to have you
        !            20: **     asked whether or not you want another game (via the reset()
        !            21: **     call).
        !            22: **
        !            23: **     Pretty straightforward, although the promotion algorithm is
        !            24: **     pretty off the wall.
        !            25: */
        !            26: 
        !            27: win()
        !            28: {
        !            29:        long                    s;
        !            30:        extern long             score();
        !            31:        extern struct cvntab    Skitab[];
        !            32:        register struct cvntab  *p;
        !            33: 
        !            34:        sleep(1);
        !            35:        printf("\nCongratulations, you have saved the Federation\n");
        !            36:        Move.endgame = 1;
        !            37: 
        !            38:        /* print and return the score */
        !            39:        s = score();
        !            40: 
        !            41:        /* decide if she gets a promotion */
        !            42:        if (Game.helps == 0 && Game.killb == 0 && Game.killinhab == 0 && 5 * Game.kills + Game.deaths < 100 &&
        !            43:                        s >= 1000 && Ship.ship == ENTERPRISE)
        !            44:        {
        !            45:                printf("In fact, you are promoted one step in rank,\n");
        !            46:                if (Game.skill >= 6)
        !            47:                        printf("to the exalted rank of Commodore Emeritus\n");
        !            48:                else
        !            49:                {
        !            50:                        p = &Skitab[Game.skill - 1];
        !            51:                        printf("from %s%s ", p->abrev, p->full);
        !            52:                        p++;
        !            53:                        printf("to %s%s\n", p->abrev, p->full);
        !            54:                }
        !            55:        }
        !            56: 
        !            57:        /* clean out input, and request new game */
        !            58:        skiptonl(0);
        !            59:        reset();
        !            60: }

unix.superglobalmegacorp.com

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