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

Defined functions

win defined in line 28; used 2 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1994-11-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2041
Valid CSS Valid XHTML 1.0 Strict