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

Defined functions

extrapolate defined in line 55; used 1 times
finalscore defined in line 11; used 2 times
undoex defined in line 99; used 1 times

Defined variables

Last_tot defined in line 49; used 3 times
Last modified: 1985-04-07
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2694
Valid CSS Valid XHTML 1.0 Strict