1: #
   2: /*      Re-coding of advent in C: termination routines                  */
   3: 
   4: static char sccsid[] = "	done.c	4.1	82/05/11	";
   5: 
   6: 
   7: # include "hdr.h"
   8: 
   9: score()                                         /* sort of like 20000   */
  10: {       register int scor,i;
  11:     mxscor=scor=0;
  12:     for (i=50; i<=maxtrs; i++)
  13:     {   if (ptext[i].txtlen==0) continue;
  14:         k=12;
  15:         if (i==chest) k=14;
  16:         if (i>chest) k=16;
  17:         if (prop[i]>=0) scor += 2;
  18:         if (place[i]==3&&prop[i]==0) scor += k-2;
  19:         mxscor += k;
  20:     }
  21:     scor += (maxdie-numdie)*10;
  22:     mxscor += maxdie*10;
  23:     if (!(scorng||gaveup)) scor += 4;
  24:     mxscor += 4;
  25:     if (dflag!=0) scor += 25;
  26:     mxscor += 25;
  27:     if (closng) scor += 25;
  28:     mxscor += 25;
  29:     if (closed)
  30:     {       if (bonus==0) scor += 10;
  31:         if (bonus==135) scor += 25;
  32:         if (bonus==134) scor += 30;
  33:         if (bonus==133) scor += 45;
  34:     }
  35:     mxscor += 45;
  36:     if (place[magzin]==108) scor++;
  37:     mxscor++;
  38:     scor += 2;
  39:     mxscor += 2;
  40:     for (i=1; i<=hntmax; i++)
  41:         if (hinted[i]) scor -= hints[i][2];
  42:     return(scor);
  43: }
  44: 
  45: done(entry)     /* entry=1 means goto 13000 */  /* game is over         */
  46: int entry;      /* entry=2 means goto 20000 */ /* 3=19000 */
  47: {       register int i,sc;
  48:     if (entry==1) mspeak(1);
  49:     if (entry==3) rspeak(136);
  50:     printf("\n\n\nYou scored %d out of a ",(sc=score()));
  51:     printf("possible %d using %d turns.\n",mxscor,turns);
  52:     for (i=1; i<=clsses; i++)
  53:         if (cval[i]>=sc)
  54:         {       speak(&ctext[i]);
  55:             if (i==clsses-1)
  56:             {       printf("To achieve the next higher rating");
  57:                 printf(" would be a neat trick!\n\n");
  58:                 printf("Congratulations!!\n");
  59:                 exit(0);
  60:             }
  61:             k=cval[i]+1-sc;
  62:             printf("To achieve the next higher rating, you need");
  63:             printf(" %d more point",k);
  64:             if (k==1) printf(".\n");
  65:             else printf("s.\n");
  66:             exit(0);
  67:         }
  68:     printf("You just went off my scale!!!\n");
  69:     exit(0);
  70: }
  71: 
  72: 
  73: die(entry)                                      /* label 90             */
  74: int entry;
  75: {       register int i;
  76:     if (entry != 99)
  77:     {       rspeak(23);
  78:         oldlc2=loc;
  79:     }
  80:     if (closng)                             /* 99                   */
  81:     {       rspeak(131);
  82:         numdie++;
  83:         done(2);
  84:     }
  85:     yea=yes(81+numdie*2,82+numdie*2,54);
  86:     numdie++;
  87:     if (numdie==maxdie || !yea) done(2);
  88:     place[water]=0;
  89:     place[oil]=0;
  90:     if (toting(lamp)) prop[lamp]=0;
  91:     for (i=100; i>=1; i--)
  92:     {       if (!toting(i)) continue;
  93:         k=oldlc2;
  94:         if (i==lamp) k=1;
  95:         drop(i,k);
  96:     }
  97:     loc=3;
  98:     oldloc=loc;
  99:     return(2000);
 100: }

Defined functions

die defined in line 73; used 4 times
done defined in line 45; used 11 times
score defined in line 9; used 2 times

Defined variables

sccsid defined in line 4; never used
Last modified: 1982-06-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1233
Valid CSS Valid XHTML 1.0 Strict