|
|
1.1 root 1: /*
2: * Copyright (c) 1982 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that: (1) source distributions retain this entire copyright
7: * notice and comment, and (2) distributions including binaries display
8: * the following acknowledgement: ``This product includes software
9: * developed by the University of California, Berkeley and its contributors''
10: * in the documentation or other materials provided with the distribution
11: * and in all advertising materials mentioning features or use of this
12: * software. Neither the name of the University nor the names of its
13: * contributors may be used to endorse or promote products derived
14: * from this software without specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: */
19:
20: #ifndef lint
21: static char sccsid[] = "@(#)end.c 5.4 (Berkeley) 6/1/90";
22: #endif /* not lint */
23:
24: # include "mille.h"
25:
26: /*
27: * @(#)end.c 1.1 (Berkeley) 4/1/82
28: */
29:
30: /*
31: * print out the score as if it was final, and add the totals for
32: * the end-of-games points to the user who deserves it (if any).
33: */
34: finalscore(pp)
35: reg PLAY *pp; {
36:
37: reg int temp, tot, num;
38:
39: if (pp->was_finished == Finished)
40: return;
41:
42: pp->was_finished = Finished;
43: num = pp - Player;
44: temp = num * 6 + 21 + 1;
45: for (tot = 5; tot <= 9; tot++)
46: mvaddstr(tot, temp, " 0");
47: if (pp->mileage == End) {
48: mvaddstr(5, temp, "40");
49: tot = SC_TRIP;
50: if (pp->nummiles[C_200] == 0) {
51: mvaddstr(6, temp, "30");
52: tot = SC_TRIP + SC_SAFE;
53: }
54: if (Topcard <= Deck) {
55: mvaddstr(7, temp, "30");
56: tot += SC_DELAY;
57: }
58: if (End == 1000) {
59: mvaddstr(8, temp, "20");
60: tot += SC_EXTENSION;
61: }
62: if (Player[other(num)].mileage == 0) {
63: mvaddstr(9, temp, "50");
64: tot += SC_SHUT_OUT;
65: }
66: pp->total += tot;
67: pp->hand_tot += tot;
68: }
69: }
70:
71: # ifdef EXTRAP
72: static int Last_tot[2]; /* last tot used for extrapolate */
73:
74: /*
75: * print out the score as if it was final, and add the totals for
76: * the end-of-games points to the user who deserves it (if any).
77: */
78: extrapolate(pp)
79: reg PLAY *pp; {
80:
81: reg int x, num, tot, count;
82:
83: num = pp - Player;
84: tot += SC_TRIP + SC_DELAY + SC_EXT;
85: x = num * 6 + 21 + 3;
86: for (tot = 5; tot <= 9; tot++)
87: mvaddch(tot, x, '0');
88: x -= 2;
89: pp = &Player[other(num)];
90: for (count = 0, tot = 0; tot < NUM_SAFE; tot++)
91: if (pp->safety[tot] != S_PLAYED)
92: count += SC_SAFE;
93: mvprintw(3, x, "%3d", count);
94: tot += count;
95: if (count == 400) {
96: mvaddstr(4, x, "30");
97: tot += SC_ALL_SAFE;
98: }
99: pp = &Player[num];
100: for (count = 0, tot = 0; tot < NUM_SAFE; tot++)
101: if (pp->safety[tot] != S_PLAYED)
102: count += SC_COUP / 10;
103: mvprintw(4, x - 1, "%3d", count);
104: tot += count;
105: tot += 1000 - pp->mileage;
106: mvaddstr(5, x, "40");
107: mvaddstr(7, x, "30");
108: mvaddstr(8, x, "20");
109: if (pp->nummiles[C_200] == 0) {
110: mvaddstr(6, x, "30");
111: tot = SC_TRIP + SC_SAFE;
112: }
113: if (Player[other(num)].mileage == 0) {
114: mvaddstr(9, x, "50");
115: tot += SC_SHUT_OUT;
116: }
117: pp->total += tot;
118: pp->hand_tot += tot;
119: Last_tot[num] = tot;
120: }
121:
122: undoex() {
123:
124: reg PLAY *pp;
125: reg int i;
126:
127: i = 0;
128: for (pp = Player; pp < &Player[2]; pp++) {
129: pp->total -= Last_tot[i];
130: pp->hand_tot -= Last_tot[i++];
131: }
132: }
133: # endif
134:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.