Annotation of 43BSD/games/trek/play.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  */
                      6: 
                      7: #ifndef lint
                      8: static char sccsid[] = "@(#)play.c     5.1 (Berkeley) 1/29/86";
                      9: #endif not lint
                     10: 
                     11: # include      "trek.h"
                     12: # include      "getpar.h"
                     13: 
                     14: /*
                     15: **  INSTRUCTION READ AND MAIN PLAY LOOP
                     16: **
                     17: **     Well folks, this is it.  Here we have the guts of the game.
                     18: **     This routine executes moves.  It sets up per-move variables,
                     19: **     gets the command, and executes the command.  After the command,
                     20: **     it calls events() to use up time, attack() to have Klingons
                     21: **     attack if the move was not free, and checkcond() to check up
                     22: **     on how we are doing after the move.
                     23: */
                     24: extern int     abandon(), capture(), shield(), computer(), dcrept(),
                     25:                destruct(), dock(), help(), impulse(), lrscan(),
                     26:                warp(), dumpgame(), rest(), shell(), srscan(),
                     27:                reset(), torped(), visual(), setwarp(), undock(), phaser();
                     28: 
                     29: struct cvntab  Comtab[] =
                     30: {
                     31:        "abandon",              "",                     abandon,        0,
                     32:        "ca",                   "pture",                capture,        0,
                     33:        "cl",                   "oak",                  shield, -1,
                     34:        "c",                    "omputer",              computer,       0,
                     35:        "da",                   "mages",                dcrept, 0,
                     36:        "destruct",             "",                     destruct,       0,
                     37:        "do",                   "ck",                   dock,           0,
                     38:        "help",                 "",                     help,           0,
                     39:        "i",                    "mpulse",               impulse,        0,
                     40:        "l",                    "rscan",                lrscan, 0,
                     41:        "m",                    "ove",                  warp,           0,
                     42:        "p",                    "hasers",               phaser, 0,
                     43:        "ram",                  "",                     warp,           1,
                     44:        "dump",                 "",                     dumpgame,       0,
                     45:        "r",                    "est",                  rest,           0,
                     46:        "shell",                "",                     shell,          0,
                     47:        "sh",                   "ield",                 shield, 0,
                     48:        "s",                    "rscan",                srscan, 0,
                     49:        "st",                   "atus",                 srscan, -1,
                     50:        "terminate",            "",                     reset,          0,
                     51:        "t",                    "orpedo",               torped, 0,
                     52:        "u",                    "ndock",                undock, 0,
                     53:        "v",                    "isual",                visual, 0,
                     54:        "w",                    "arp",                  setwarp,        0,
                     55:        0
                     56: };
                     57: 
                     58: play()
                     59: {
                     60:        struct cvntab           *r;
                     61: 
                     62:        while (1)
                     63:        {
                     64:                Move.free = 1;
                     65:                Move.time = 0.0;
                     66:                Move.shldchg = 0;
                     67:                Move.newquad = 0;
                     68:                Move.resting = 0;
                     69:                skiptonl(0);
                     70:                r = getcodpar("\nCommand", Comtab);
                     71:                (*r->value)(r->value2);
                     72:                events(0);
                     73:                attack(0);
                     74:                checkcond();
                     75:        }
                     76: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.