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: #ifndef lint
   8: static char sccsid[] = "@(#)com6.c	1.3 4/24/85";
   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: post(ch)
  66: char ch;
  67: {
  68:     FILE *fp;
  69:     struct timeval tv;
  70:     char *date;
  71:     int s = sigblock(sigmask(SIGINT));
  72: 
  73:     gettimeofday(&tv, (struct timezone *)0);    /* can't call time */
  74:     date = ctime(&tv.tv_sec);
  75:     date[24] = '\0';
  76:     if (fp = fopen(logfile,"a")) {
  77:         fprintf(fp, "%s  %8s  %c%20s", date, uname, ch, rate());
  78:         if (wiz)
  79:             fprintf(fp, "   wizard\n");
  80:         else if (tempwiz)
  81:             fprintf(fp, "   WIZARD!\n");
  82:         else
  83:             fprintf(fp, "\n");
  84:     } else
  85:         perror(logfile);
  86:     sigsetmask(s);
  87: }
  88: 
  89: char *
  90: rate()
  91: {
  92:     int score;
  93: 
  94:     score = max(max(pleasure,power),ego);
  95:     if (score == pleasure){
  96:         if (score < 5)
  97:             return("novice");
  98:         else if (score < 20)
  99:             return("junior voyeur");
 100:         else if (score < 35)
 101:             return("Don Juan");
 102:         else return("Marquis De Sade");
 103:     }
 104:     else if (score == power){
 105:         if (score < 5)
 106:             return("serf");
 107:         else if (score < 8)
 108:             return("Samurai");
 109:         else if (score < 13)
 110:             return("Klingon");
 111:         else if (score < 22)
 112:             return("Darth Vader");
 113:         else return("Sauron the Great");
 114:     }
 115:     else{
 116:         if (score < 5)
 117:             return("Polyanna");
 118:         else if (score < 10)
 119:             return("philanthropist");
 120:         else if (score < 20)
 121:             return("Tattoo");
 122:         else return("Mr. Roarke");
 123:     }
 124: }
 125: 
 126: drive()
 127: {
 128:     if (testbit(location[position].objects,CAR)){
 129:         puts("You hop in the car and turn the key.  There is a perceptible grating noise,");
 130:         puts("and an explosion knocks you unconscious...");
 131:         clearbit(location[position].objects,CAR);
 132:         setbit(location[position].objects,CRASH);
 133:         injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1;
 134:         time += 15;
 135:         zzz();
 136:         return(0);
 137:     }
 138:     else
 139:         puts("There is nothing to drive here.");
 140:     return(-1);
 141: }
 142: 
 143: ride()
 144: {
 145:     if (testbit(location[position].objects,HORSE)){
 146:         puts("You climb onto the stallion and kick it in the guts.  The stupid steed launches");
 147:         puts("forward through bush and fern.  You are thrown and the horse gallups off.");
 148:         clearbit(location[position].objects,HORSE);
 149:         while (!(position = rnd(NUMOFROOMS+1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere);
 150:         setbit(location[position].objects,HORSE);
 151:         if (location[position].north)
 152:             position = location[position].north;
 153:         else if (location[position].south)
 154:             position = location[position].south;
 155:         else if (location[position].east)
 156:             position = location[position].east;
 157:         else
 158:             position = location[position].west;
 159:         return(0);
 160:     }
 161:     else puts("There is no horse here.");
 162:     return(-1);
 163: }
 164: 
 165: light()     /* synonyms = {strike, smoke} */
 166: {       /* for matches, cigars */
 167:     if (testbit(inven,MATCHES) && matchcount){
 168:         puts("Your match splutters to life.");
 169:         time++;
 170:         matchlight = 1;
 171:         matchcount--;
 172:         if (position == 217){
 173:             puts("The whole bungalow explodes with an intense blast.");
 174:             die();
 175:         }
 176:     }
 177:     else puts("You're out of matches.");
 178: }

Defined functions

drive defined in line 126; used 1 times
land defined in line 34; used 1 times
launch defined in line 13; used 1 times
light defined in line 165; used 1 times
live defined in line 57; used 2 times
post defined in line 65; used 2 times
rate defined in line 89; used 4 times
ride defined in line 143; used 1 times

Defined variables

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