1: /*
   2:  * Copyright (c) 1983 Regents of the University of California,
   3:  * All rights reserved.  Redistribution permitted subject to
   4:  * the terms of the Berkeley Software License Agreement.
   5:  */
   6: 
   7: #if !defined(lint) && !defined(pdp11)
   8: static char sccsid[] = "@(#)com6.c	1.3.2 1999/10/25";
   9: #endif
  10: 
  11: #include "externs.h"
  12: 
  13: launch()
  14: {
  15:     if (testbit(location[position].objects,VIPER) && !notes[CANTLAUNCH]){
  16:         if (fuel > 4){
  17:             clearbit(location[position].objects,VIPER);
  18:             position = location[position].up;
  19:             notes[LAUNCHED] = 1;
  20:             Time++;
  21:             fuel -= 4;
  22:             puts("You climb into the viper and prepare for launch.");
  23:             puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
  24:             return(1);
  25:         }
  26:         else
  27:             puts("Not enough fuel to launch.");
  28:      }
  29:      else
  30:         puts("Can't launch.");
  31:      return(0);
  32: }
  33: 
  34: land()
  35: {
  36:     if (notes[LAUNCHED] && testbit(location[position].objects,LAND) && location[position].down){
  37:         notes[LAUNCHED] = 0;
  38:         position = location[position].down;
  39:         setbit(location[position].objects,VIPER);
  40:         fuel -= 2;
  41:         Time++;
  42:         puts("You are down.");
  43:         return(1);
  44:     }
  45:     else
  46:         puts("You can't land here.");
  47:     return(0);
  48: }
  49: 
  50: die()       /* endgame */
  51: {
  52:     printf("bye.\nYour rating was %s.\n", rate());
  53:     post(' ');
  54:     exit(0);
  55: }
  56: 
  57: live()
  58: {
  59:     puts("\nYou win!");
  60:     post('!');
  61:     exit(0);
  62: }
  63: 
  64: #include <sys/time.h>
  65: 
  66: post(ch)
  67: char ch;
  68: {
  69:     FILE *fp;
  70:     struct timeval tv;
  71:     char *date;
  72:     sigset_t s, oset;
  73: 
  74:     sigemptyset(&s);
  75:     sigaddset(&s, SIGINT);
  76:     (void)sigprocmask(SIG_BLOCK, &s, &oset);
  77:     gettimeofday(&tv, (struct timezone *)0);
  78:     date = ctime(&tv.tv_sec);
  79:     date[24] = '\0';
  80:     if (fp = fopen(logfile,"a")) {
  81:         fprintf(fp, "%s  %8s  %c%20s", date, uname, ch, rate());
  82:         if (wiz)
  83:             fprintf(fp, "   wizard\n");
  84:         else if (tempwiz)
  85:             fprintf(fp, "   WIZARD!\n");
  86:         else
  87:             fprintf(fp, "\n");
  88:     } else
  89:         perror(logfile);
  90:     (void)sigprocmask(SIG_SETMASK, &oset, NULL);
  91: }
  92: 
  93: char *
  94: rate()
  95: {
  96:     int score;
  97: 
  98:     score = max(max(pleasure,power),ego);
  99:     if (score == pleasure){
 100:         if (score < 5)
 101:             return("novice");
 102:         else if (score < 20)
 103:             return("junior voyeur");
 104:         else if (score < 35)
 105:             return("Don Juan");
 106:         else return("Marquis De Sade");
 107:     }
 108:     else if (score == power){
 109:         if (score < 5)
 110:             return("serf");
 111:         else if (score < 8)
 112:             return("Samurai");
 113:         else if (score < 13)
 114:             return("Klingon");
 115:         else if (score < 22)
 116:             return("Darth Vader");
 117:         else return("Sauron the Great");
 118:     }
 119:     else{
 120:         if (score < 5)
 121:             return("Polyanna");
 122:         else if (score < 10)
 123:             return("philanthropist");
 124:         else if (score < 20)
 125:             return("Tattoo");
 126:         else return("Mr. Roarke");
 127:     }
 128: }
 129: 
 130: drive()
 131: {
 132:     if (testbit(location[position].objects,CAR)){
 133:         puts("You hop in the car and turn the key.  There is a perceptible grating noise,");
 134:         puts("and an explosion knocks you unconscious...");
 135:         clearbit(location[position].objects,CAR);
 136:         setbit(location[position].objects,CRASH);
 137:         injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1;
 138:         Time += 15;
 139:         zzz();
 140:         return(0);
 141:     }
 142:     else
 143:         puts("There is nothing to drive here.");
 144:     return(-1);
 145: }
 146: 
 147: ride()
 148: {
 149:     if (testbit(location[position].objects,HORSE)){
 150:         puts("You climb onto the stallion and kick it in the guts.  The stupid steed launches");
 151:         puts("forward through bush and fern.  You are thrown and the horse gallups off.");
 152:         clearbit(location[position].objects,HORSE);
 153:         while (!(position = rnd(NUMOFROOMS+1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere);
 154:         setbit(location[position].objects,HORSE);
 155:         if (location[position].north)
 156:             position = location[position].north;
 157:         else if (location[position].south)
 158:             position = location[position].south;
 159:         else if (location[position].east)
 160:             position = location[position].east;
 161:         else
 162:             position = location[position].west;
 163:         return(0);
 164:     }
 165:     else puts("There is no horse here.");
 166:     return(-1);
 167: }
 168: 
 169: light()     /* synonyms = {strike, smoke} */
 170: {       /* for matches, cigars */
 171:     if (testbit(inven,MATCHES) && matchcount){
 172:         puts("Your match splutters to life.");
 173:         Time++;
 174:         matchlight = 1;
 175:         matchcount--;
 176:         if (position == 217){
 177:             puts("The whole bungalow explodes with an intense blast.");
 178:             die();
 179:         }
 180:     }
 181:     else puts("You're out of matches.");
 182: }

Defined functions

drive defined in line 130; used 1 times
land defined in line 34; used 1 times
launch defined in line 13; used 1 times
light defined in line 169; used 1 times
live defined in line 57; used 2 times
post defined in line 66; used 2 times
rate defined in line 93; used 4 times
ride defined in line 147; used 1 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1999-10-26
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3556
Valid CSS Valid XHTML 1.0 Strict