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[] = "@(#)init.c	1.3.1 1996/10/26";
   9: #endif
  10: 
  11: #include "externs.h"
  12: #include <pwd.h>
  13: 
  14: initialize(startup)
  15:     char startup;
  16: {
  17:     register struct objs *p;
  18:     int die();
  19: 
  20:     puts("Version 4.2, fall 1984.");
  21:     puts("First Adventure game written by His Lordship, the honorable");
  22:     puts("Admiral D.W. Riggle\n");
  23:     srand(getpid());
  24:     getutmp(uname);
  25:     wiz = wizard(uname);
  26:     wordinit();
  27:     if (startup) {
  28:         location = dayfile;
  29:         direction = NORTH;
  30:         Time = 0;
  31:         snooze = CYCLE * 1.5;
  32:         position = 22;
  33:         setbit(wear, PAJAMAS);
  34:         fuel = TANKFULL;
  35:         torps = TORPEDOES;
  36:         for (p = dayobjs; p->room != 0; p++)
  37:             setbit(location[p->room].objects, p->obj);
  38:     } else
  39:         restore();
  40:     signal(SIGINT, die);
  41: }
  42: 
  43: getutmp(uname)
  44:     char *uname;
  45: {
  46:     struct passwd *ptr;
  47: 
  48:     ptr = getpwuid(getuid());
  49:     strcpy(uname, ptr ? ptr->pw_name : "");
  50: }
  51: 
  52: char *list[] = {    /* hereditary wizards */
  53:     "riggle",
  54:     "chris",
  55:     "games",
  56:     "edward",
  57:     "comay",
  58:     "yee",
  59:     "dmr",
  60:     "ken",
  61:     0
  62: };
  63: 
  64: char *badguys[] = {
  65:     "wnj",
  66:     "root",
  67:     "ted",
  68:     0
  69: };
  70: 
  71: wizard(uname)
  72:     char *uname;
  73: {
  74:     char flag;
  75: 
  76:     if (flag = checkout(uname))
  77:         printf("You are the Great wizard %s.\n", uname);
  78:     return flag;
  79: }
  80: 
  81: checkout(uname)
  82:     register char *uname;
  83: {
  84:     register char **ptr;
  85: 
  86:     for (ptr = list; *ptr; ptr++)
  87:         if (strcmp(*ptr, uname) == 0)
  88:             return 1;
  89:     for (ptr = badguys; *ptr; ptr++)
  90:         if (strcmp(*ptr, uname) == 0) {
  91:             printf("You are the Poor anti-wizard %s.  Good Luck!\n",
  92:                 uname);
  93:             CUMBER = 3;
  94:             WEIGHT = 9; /* that'll get him! */
  95:             clock = 10;
  96:             setbit(location[7].objects, WOODSMAN);  /* viper room */
  97:             setbit(location[20].objects, WOODSMAN); /* laser " */
  98:             setbit(location[13].objects, DARK); /* amulet " */
  99:             setbit(location[8].objects, ELF);   /* closet */
 100:             return 0;   /* anything else, Chris? */
 101:         }
 102:     return 0;
 103: }

Defined functions

checkout defined in line 81; used 1 times
  • in line 76
getutmp defined in line 43; used 1 times
  • in line 24
initialize defined in line 14; used 1 times
wizard defined in line 71; used 1 times
  • in line 25

Defined variables

badguys defined in line 64; used 1 times
  • in line 89
list defined in line 52; used 1 times
  • in line 86
sccsid defined in line 8; never used
Last modified: 1996-10-27
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2995
Valid CSS Valid XHTML 1.0 Strict