Annotation of 42BSD/games/trek/play.c, revision 1.1

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

unix.superglobalmegacorp.com

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