Annotation of 43BSDReno/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.
        !             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[] = "@(#)win.c      5.5 (Berkeley) 6/26/90";
        !            22: #endif /* not lint */
        !            23: 
        !            24: # include      "trek.h"
        !            25: # include      "getpar.h"
        !            26: # include      <setjmp.h>
        !            27: 
        !            28: /*
        !            29: **  Signal game won
        !            30: **
        !            31: **     This routine prints out the win message, arranges to print out
        !            32: **     your score, tells you if you have a promotion coming to you,
        !            33: **     cleans up the current input line, and arranges to have you
        !            34: **     asked whether or not you want another game (via the longjmp()
        !            35: **     call).
        !            36: **
        !            37: **     Pretty straightforward, although the promotion algorithm is
        !            38: **     pretty off the wall.
        !            39: */
        !            40: 
        !            41: win()
        !            42: {
        !            43:        long                    s;
        !            44:        extern jmp_buf          env;
        !            45:        extern long             score();
        !            46:        extern struct cvntab    Skitab[];
        !            47:        register struct cvntab  *p;
        !            48: 
        !            49:        sleep(1);
        !            50:        printf("\nCongratulations, you have saved the Federation\n");
        !            51:        Move.endgame = 1;
        !            52: 
        !            53:        /* print and return the score */
        !            54:        s = score();
        !            55: 
        !            56:        /* decide if she gets a promotion */
        !            57:        if (Game.helps == 0 && Game.killb == 0 && Game.killinhab == 0 && 5 * Game.kills + Game.deaths < 100 &&
        !            58:                        s >= 1000 && Ship.ship == ENTERPRISE)
        !            59:        {
        !            60:                printf("In fact, you are promoted one step in rank,\n");
        !            61:                if (Game.skill >= 6)
        !            62:                        printf("to the exalted rank of Commodore Emeritus\n");
        !            63:                else
        !            64:                {
        !            65:                        p = &Skitab[Game.skill - 1];
        !            66:                        printf("from %s%s ", p->abrev, p->full);
        !            67:                        p++;
        !            68:                        printf("to %s%s\n", p->abrev, p->full);
        !            69:                }
        !            70:        }
        !            71: 
        !            72:        /* clean out input, and request new game */
        !            73:        skiptonl(0);
        !            74:        longjmp(env, 1);
        !            75: }

unix.superglobalmegacorp.com

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