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