Annotation of 43BSDTahoe/games/trek/play.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1980 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that the above copyright notice and this paragraph are
        !             7:  * duplicated in all such forms and that any documentation,
        !             8:  * advertising materials, and other materials related to such
        !             9:  * distribution and use acknowledge that the software was developed
        !            10:  * by the University of California, Berkeley.  The name of the
        !            11:  * University may not be used to endorse or promote products derived
        !            12:  * from this software without specific prior written permission.
        !            13:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            14:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            15:  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            16:  */
        !            17: 
        !            18: #ifndef lint
        !            19: static char sccsid[] = "@(#)play.c     5.3 (Berkeley) 6/18/88";
        !            20: #endif /* not lint */
        !            21: 
        !            22: # include      "trek.h"
        !            23: # include      "getpar.h"
        !            24: 
        !            25: /*
        !            26: **  INSTRUCTION READ AND MAIN PLAY LOOP
        !            27: **
        !            28: **     Well folks, this is it.  Here we have the guts of the game.
        !            29: **     This routine executes moves.  It sets up per-move variables,
        !            30: **     gets the command, and executes the command.  After the command,
        !            31: **     it calls events() to use up time, attack() to have Klingons
        !            32: **     attack if the move was not free, and checkcond() to check up
        !            33: **     on how we are doing after the move.
        !            34: */
        !            35: extern int     abandon(), capture(), shield(), computer(), dcrept(),
        !            36:                destruct(), dock(), help(), impulse(), lrscan(),
        !            37:                warp(), dumpgame(), rest(), shell(), srscan(),
        !            38:                reset(), torped(), visual(), setwarp(), undock(), phaser();
        !            39: 
        !            40: struct cvntab  Comtab[] =
        !            41: {
        !            42:        "abandon",              "",                     abandon,        0,
        !            43:        "ca",                   "pture",                capture,        0,
        !            44:        "cl",                   "oak",                  shield, -1,
        !            45:        "c",                    "omputer",              computer,       0,
        !            46:        "da",                   "mages",                dcrept, 0,
        !            47:        "destruct",             "",                     destruct,       0,
        !            48:        "do",                   "ck",                   dock,           0,
        !            49:        "help",                 "",                     help,           0,
        !            50:        "i",                    "mpulse",               impulse,        0,
        !            51:        "l",                    "rscan",                lrscan, 0,
        !            52:        "m",                    "ove",                  warp,           0,
        !            53:        "p",                    "hasers",               phaser, 0,
        !            54:        "ram",                  "",                     warp,           1,
        !            55:        "dump",                 "",                     dumpgame,       0,
        !            56:        "r",                    "est",                  rest,           0,
        !            57:        "shell",                "",                     shell,          0,
        !            58:        "sh",                   "ield",                 shield, 0,
        !            59:        "s",                    "rscan",                srscan, 0,
        !            60:        "st",                   "atus",                 srscan, -1,
        !            61:        "terminate",            "",                     reset,          0,
        !            62:        "t",                    "orpedo",               torped, 0,
        !            63:        "u",                    "ndock",                undock, 0,
        !            64:        "v",                    "isual",                visual, 0,
        !            65:        "w",                    "arp",                  setwarp,        0,
        !            66:        0
        !            67: };
        !            68: 
        !            69: play()
        !            70: {
        !            71:        struct cvntab           *r;
        !            72: 
        !            73:        while (1)
        !            74:        {
        !            75:                Move.free = 1;
        !            76:                Move.time = 0.0;
        !            77:                Move.shldchg = 0;
        !            78:                Move.newquad = 0;
        !            79:                Move.resting = 0;
        !            80:                skiptonl(0);
        !            81:                r = getcodpar("\nCommand", Comtab);
        !            82:                (*r->value)(r->value2);
        !            83:                events(0);
        !            84:                attack(0);
        !            85:                checkcond();
        !            86:        }
        !            87: }

unix.superglobalmegacorp.com

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