Annotation of researchv10no/games/trek/shield.c, revision 1.1.1.1

1.1       root        1: # include      "trek.h"
                      2: 
                      3: /**
                      4:  **    shield and cloaking device control
                      5:  **/
                      6: 
                      7: CVNTAB Udtab[]
                      8: {
                      9:        "d",            "own",
                     10:        "u",            "p",
                     11:        0
                     12: };
                     13: 
                     14: shield()
                     15: {
                     16:        protect(SHIELD);
                     17: }
                     18: 
                     19: cloak()
                     20: {
                     21:        protect(CLOAK);
                     22: }
                     23: 
                     24: protect(sw)
                     25: int    sw;
                     26: {
                     27:        register int            i;
                     28:        char                    *device;
                     29:        int                     ind;
                     30:        char                    *stat;
                     31: 
                     32:        if (sw == CLOAK)
                     33:        {
                     34:                /* cloaking device */
                     35:                if (Status.ship == QUEENE) {
                     36:                        error("Ye Faire Queene does not have the cloaking device.\n");
                     37:                        return;
                     38:                }
                     39:                device = "Cloaking device";
                     40:                ind = CLOAK;
                     41:                stat = &Status.cloaked;
                     42:        }
                     43:        else
                     44:        {
                     45:                /* shields */
                     46:                device = "Shields";
                     47:                ind = SHIELD;
                     48:                stat = &Status.shldup;
                     49:        }
                     50:        if (Damage[ind])
                     51:        {
                     52:                error(device, " inoperable\n");
                     53:                return;
                     54:        }
                     55:        if(sw) {
                     56:                if(lineended()) {
                     57:                        printf("%s %s; ", device,
                     58:                                (*stat?"up":"down")
                     59:                                );
                     60:                }
                     61:                if((i=getcodpar("Up or down", Udtab))<0) return;
                     62:        } else {
                     63:                i = !*stat;
                     64:        }
                     65:        if(*stat==i)
                     66:                return;
                     67:        if (i)
                     68:                if(sw!=CLOAK)
                     69:                        Status.energy =- Param.shupengy;
                     70:                else
                     71:                        Status.cloakdate = Status.date;
                     72:        Move.free = 0;
                     73:        if(sw!=CLOAK)
                     74:                Move.shldchg = 1;
                     75:        *stat = i;
                     76:        return;
                     77: }

unix.superglobalmegacorp.com

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