|
|
1.1 ! root 1: # include "mille.h" ! 2: ! 3: /* ! 4: * @(#)end.c 1.1 (Berkeley) 4/1/82 ! 5: */ ! 6: ! 7: /* ! 8: * print out the score as if it was final, and add the totals for ! 9: * the end-of-games points to the user who deserves it (if any). ! 10: */ ! 11: finalscore(pp) ! 12: reg PLAY *pp; { ! 13: ! 14: reg int temp, tot, num; ! 15: ! 16: num = pp - Player; ! 17: temp = num * 6 + 21 + 3; ! 18: for (tot = 5; tot <= 9; tot++) ! 19: mvaddch(tot, temp, '0'); ! 20: if (pp->mileage == End) { ! 21: temp -= 2; ! 22: mvaddstr(5, temp, "40"); ! 23: tot = SC_TRIP; ! 24: if (pp->nummiles[C_200] == 0) { ! 25: mvaddstr(6, temp, "30"); ! 26: tot = SC_TRIP + SC_SAFE; ! 27: } ! 28: if (Topcard <= Deck) { ! 29: mvaddstr(7, temp, "30"); ! 30: tot += SC_DELAY; ! 31: } ! 32: if (End == 1000) { ! 33: mvaddstr(8, temp, "20"); ! 34: tot += SC_EXTENSION; ! 35: } ! 36: if (Player[other(num)].mileage == 0) { ! 37: mvaddstr(9, temp, "50"); ! 38: tot += SC_SHUT_OUT; ! 39: } ! 40: pp->total += tot; ! 41: pp->hand_tot += tot; ! 42: } ! 43: } ! 44: ! 45: # ifdef EXTRAP ! 46: static int Last_tot[2]; /* last tot used for extrapolate */ ! 47: ! 48: /* ! 49: * print out the score as if it was final, and add the totals for ! 50: * the end-of-games points to the user who deserves it (if any). ! 51: */ ! 52: extrapolate(pp) ! 53: reg PLAY *pp; { ! 54: ! 55: reg int x, num, tot, count; ! 56: ! 57: num = pp - Player; ! 58: tot += SC_TRIP + SC_DELAY + SC_EXT; ! 59: x = num * 6 + 21 + 3; ! 60: for (tot = 5; tot <= 9; tot++) ! 61: mvaddch(tot, x, '0'); ! 62: x -= 2; ! 63: pp = &Player[other(num)]; ! 64: for (count = 0, tot = 0; tot < NUM_SAFE; tot++) ! 65: if (pp->safety[tot] != S_PLAYED) ! 66: count += SC_SAFE; ! 67: mvprintw(3, x, "%3d", count); ! 68: tot += count; ! 69: if (count == 400) { ! 70: mvaddstr(4, x, "30"); ! 71: tot += SC_ALL_SAFE; ! 72: } ! 73: pp = &Player[num]; ! 74: for (count = 0, tot = 0; tot < NUM_SAFE; tot++) ! 75: if (pp->safety[tot] != S_PLAYED) ! 76: count += SC_COUP / 10; ! 77: mvprintw(4, x - 1, "%3d", count); ! 78: tot += count; ! 79: tot += 1000 - pp->mileage; ! 80: mvaddstr(5, x, "40"); ! 81: mvaddstr(7, x, "30"); ! 82: mvaddstr(8, x, "20"); ! 83: if (pp->nummiles[C_200] == 0) { ! 84: mvaddstr(6, x, "30"); ! 85: tot = SC_TRIP + SC_SAFE; ! 86: } ! 87: if (Player[other(num)].mileage == 0) { ! 88: mvaddstr(9, x, "50"); ! 89: tot += SC_SHUT_OUT; ! 90: } ! 91: pp->total += tot; ! 92: pp->hand_tot += tot; ! 93: Last_tot[num] = tot; ! 94: } ! 95: ! 96: undoex() { ! 97: ! 98: reg PLAY *pp; ! 99: reg int i; ! 100: ! 101: i = 0; ! 102: for (pp = Player; pp < &Player[2]; pp++) { ! 103: pp->total -= Last_tot[i]; ! 104: pp->hand_tot -= Last_tot[i++]; ! 105: } ! 106: } ! 107: # endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.