1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)win.c 5.4 (Berkeley) 06/01/90"; 10 #endif /* not lint */ 11 12 # include "trek.h" 13 # include "getpar.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 long score(); 32 extern struct cvntab Skitab[]; 33 register struct cvntab *p; 34 35 sleep(1); 36 printf("\nCongratulations, you have saved the Federation\n"); 37 Move.endgame = 1; 38 39 /* print and return the score */ 40 s = score(); 41 42 /* decide if she gets a promotion */ 43 if (Game.helps == 0 && Game.killb == 0 && Game.killinhab == 0 && 5 * Game.kills + Game.deaths < 100 && 44 s >= 1000 && Ship.ship == ENTERPRISE) 45 { 46 printf("In fact, you are promoted one step in rank,\n"); 47 if (Game.skill >= 6) 48 printf("to the exalted rank of Commodore Emeritus\n"); 49 else 50 { 51 p = &Skitab[Game.skill - 1]; 52 printf("from %s%s ", p->abrev, p->full); 53 p++; 54 printf("to %s%s\n", p->abrev, p->full); 55 } 56 } 57 58 /* clean out input, and request new game */ 59 skiptonl(0); 60 reset(); 61 } 62