Annotation of 42BSD/games/trek/win.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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