Sun May 24 22:57:37 2009 UTC ()
Sprinkle some blank lines for readability.


(dholland)
diff -r1.8 -r1.9 src/games/trek/score.c

cvs diff -r1.8 -r1.9 src/games/trek/score.c (expand / switch to unified diff)

--- src/games/trek/score.c 2009/05/24 22:55:03 1.8
+++ src/games/trek/score.c 2009/05/24 22:57:37 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: score.c,v 1.8 2009/05/24 22:55:03 dholland Exp $ */ 1/* $NetBSD: score.c,v 1.9 2009/05/24 22:57:37 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1980, 1993 4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,84 +24,97 @@ @@ -24,84 +24,97 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34#if 0 34#if 0
35static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; 35static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
36#else 36#else
37__RCSID("$NetBSD: score.c,v 1.8 2009/05/24 22:55:03 dholland Exp $"); 37__RCSID("$NetBSD: score.c,v 1.9 2009/05/24 22:57:37 dholland Exp $");
38#endif 38#endif
39#endif /* not lint */ 39#endif /* not lint */
40 40
41#include <stdio.h> 41#include <stdio.h>
42#include "trek.h" 42#include "trek.h"
43#include "getpar.h" 43#include "getpar.h"
44 44
45/* 45/*
46** PRINT OUT THE CURRENT SCORE 46** PRINT OUT THE CURRENT SCORE
47*/ 47*/
48 48
49long 49long
50score(void) 50score(void)
51{ 51{
52 int u; 52 int u;
53 int t; 53 int t;
54 long s; 54 long s;
55 double r; 55 double r;
56 56
57 printf("\n*** Your score:\n"); 57 printf("\n*** Your score:\n");
 58
58 s = t = Param.klingpwr / 4 * (u = Game.killk); 59 s = t = Param.klingpwr / 4 * (u = Game.killk);
59 if (t != 0) 60 if (t != 0)
60 printf("%d Klingons killed\t\t\t%6d\n", u, t); 61 printf("%d Klingons killed\t\t\t%6d\n", u, t);
 62
61 r = Now.date - Param.date; 63 r = Now.date - Param.date;
62 if (r < 1.0) 64 if (r < 1.0)
63 r = 1.0; 65 r = 1.0;
64 r = Game.killk / r; 66 r = Game.killk / r;
65 s += (t = 400 * r); 67 s += (t = 400 * r);
66 if (t != 0) 68 if (t != 0)
67 printf("Kill rate %.2f Klingons/stardate \t%6d\n", r, t); 69 printf("Kill rate %.2f Klingons/stardate \t%6d\n", r, t);
 70
68 r = Now.klings; 71 r = Now.klings;
69 r /= Game.killk + 1; 72 r /= Game.killk + 1;
70 s += (t = -400 * r); 73 s += (t = -400 * r);
71 if (t != 0) 74 if (t != 0)
72 printf("Penalty for %d klingons remaining\t%6d\n", Now.klings, 75 printf("Penalty for %d klingons remaining\t%6d\n", Now.klings,
73 t); 76 t);
 77
74 if (Move.endgame > 0) { 78 if (Move.endgame > 0) {
75 s += (t = 100 * (u = Game.skill)); 79 s += (t = 100 * (u = Game.skill));
76 printf("Bonus for winning a %s%s game\t\t%6d\n", 80 printf("Bonus for winning a %s%s game\t\t%6d\n",
77 Skitab[u - 1].abrev, Skitab[u - 1].full, t); 81 Skitab[u - 1].abrev, Skitab[u - 1].full, t);
78 } 82 }
 83
79 if (Game.killed) { 84 if (Game.killed) {
80 s -= 500; 85 s -= 500;
81 printf("Penalty for getting killed\t\t -500\n"); 86 printf("Penalty for getting killed\t\t -500\n");
82 } 87 }
 88
83 s += (t = -100 * (u = Game.killb)); 89 s += (t = -100 * (u = Game.killb));
84 if (t != 0) 90 if (t != 0)
85 printf("%d starbases killed\t\t\t%6d\n", u, t); 91 printf("%d starbases killed\t\t\t%6d\n", u, t);
 92
86 s += (t = -100 * (u = Game.helps)); 93 s += (t = -100 * (u = Game.helps));
87 if (t != 0) 94 if (t != 0)
88 printf("%d calls for help\t\t\t%6d\n", u, t); 95 printf("%d calls for help\t\t\t%6d\n", u, t);
 96
89 s += (t = -5 * (u = Game.kills)); 97 s += (t = -5 * (u = Game.kills));
90 if (t != 0) 98 if (t != 0)
91 printf("%d stars destroyed\t\t\t%6d\n", u, t); 99 printf("%d stars destroyed\t\t\t%6d\n", u, t);
 100
92 s += (t = -150 * (u = Game.killinhab)); 101 s += (t = -150 * (u = Game.killinhab));
93 if (t != 0) 102 if (t != 0)
94 printf("%d inhabited starsystems destroyed\t%6d\n", u, t); 103 printf("%d inhabited starsystems destroyed\t%6d\n", u, t);
 104
95 if (Ship.ship != ENTERPRISE) { 105 if (Ship.ship != ENTERPRISE) {
96 s -= 200; 106 s -= 200;
97 printf("penalty for abandoning ship\t\t -200\n"); 107 printf("penalty for abandoning ship\t\t -200\n");
98 } 108 }
 109
99 s += (t = 3 * (u = Game.captives)); 110 s += (t = 3 * (u = Game.captives));
100 if (t != 0) 111 if (t != 0)
101 printf("%d Klingons captured\t\t\t%6d\n", u, t); 112 printf("%d Klingons captured\t\t\t%6d\n", u, t);
 113
102 s += (t = -(u = Game.deaths)); 114 s += (t = -(u = Game.deaths));
103 if (t != 0) 115 if (t != 0)
104 printf("%d casualties\t\t\t\t%6d\n", u, t); 116 printf("%d casualties\t\t\t\t%6d\n", u, t);
 117
105 printf("\n*** TOTAL\t\t\t%14ld\n", s); 118 printf("\n*** TOTAL\t\t\t%14ld\n", s);
106 return (s); 119 return (s);
107} 120}