1 /*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8 #ifndef lint
9 static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 05/31/93";
10 #endif /* not lint */
11
12 # include "trek.h"
13 # include "getpar.h"
14
15 /*
16 ** PRINT OUT THE CURRENT SCORE
17 */
18
score()19 long score()
20 {
21 register int u;
22 register int t;
23 long s;
24 double r;
25 extern struct cvntab Skitab[];
26
27 printf("\n*** Your score:\n");
28 s = t = Param.klingpwr / 4 * (u = Game.killk);
29 if (t != 0)
30 printf("%d Klingons killed\t\t\t%6d\n", u, t);
31 r = Now.date - Param.date;
32 if (r < 1.0)
33 r = 1.0;
34 r = Game.killk / r;
35 s += (t = 400 * r);
36 if (t != 0)
37 printf("Kill rate %.2f Klingons/stardate \t%6d\n", r, t);
38 r = Now.klings;
39 r /= Game.killk + 1;
40 s += (t = -400 * r);
41 if (t != 0)
42 printf("Penalty for %d klingons remaining\t%6d\n", Now.klings, t);
43 if (Move.endgame > 0)
44 {
45 s += (t = 100 * (u = Game.skill));
46 printf("Bonus for winning a %s%s game\t\t%6d\n", Skitab[u - 1].abrev, Skitab[u - 1].full, t);
47 }
48 if (Game.killed)
49 {
50 s -= 500;
51 printf("Penalty for getting killed\t\t -500\n");
52 }
53 s += (t = -100 * (u = Game.killb));
54 if (t != 0)
55 printf("%d starbases killed\t\t\t%6d\n", u, t);
56 s += (t = -100 * (u = Game.helps));
57 if (t != 0)
58 printf("%d calls for help\t\t\t%6d\n", u, t);
59 s += (t = -5 * (u = Game.kills));
60 if (t != 0)
61 printf("%d stars destroyed\t\t\t%6d\n", u, t);
62 s += (t = -150 * (u = Game.killinhab));
63 if (t != 0)
64 printf("%d inhabited starsystems destroyed\t%6d\n", u, t);
65 if (Ship.ship != ENTERPRISE)
66 {
67 s -= 200;
68 printf("penalty for abandoning ship\t\t -200\n");
69 }
70 s += (t = 3 * (u = Game.captives));
71 if (t != 0)
72 printf("%d Klingons captured\t\t\t%6d\n", u, t);
73 s += (t = -(u = Game.deaths));
74 if (t != 0)
75 printf("%d casualties\t\t\t\t%6d\n", u, t);
76 printf("\n*** TOTAL\t\t\t%14ld\n", s);
77 return (s);
78 }
79