Annotation of researchv10no/games/trek/dock.c, revision 1.1

1.1     ! root        1: # include      "trek.h"
        !             2: 
        !             3: /**
        !             4:  **    dock to starbase
        !             5:  **/
        !             6: 
        !             7: dock()
        !             8: {
        !             9:        register int            i, j;
        !            10:        int                     ok;
        !            11:        register EVENT          *e;
        !            12: 
        !            13:        if (Status.cond == DOCKED) {
        !            14:                printf("Chekov: But captain, we are already docked\n");
        !            15:                return;
        !            16:        }
        !            17:        /* check for ok to dock */
        !            18:        ok = 0;
        !            19:        for (i = Sectx - 1; i <= Sectx + 1 && !ok; i++)
        !            20:        {
        !            21:                if (i < 0 || i >= NSECTS)
        !            22:                        continue;
        !            23:                for (j = Secty - 1; j <= Secty + 1; j++)
        !            24:                {
        !            25:                        if (j  < 0 || j >= NSECTS)
        !            26:                                continue;
        !            27:                        if (Sect[i][j] == BASE)
        !            28:                        {
        !            29:                                ok = 1;
        !            30:                                break;
        !            31:                        }
        !            32:                }
        !            33:        }
        !            34:        if (!ok) {
        !            35:                printf("Chekov: But captain, we are not adjacent to a starbase.\n");
        !            36:                return;
        !            37:        }
        !            38: 
        !            39:        Status.energy = Initial.energy;
        !            40:        Status.torped = Initial.torped;
        !            41:        Status.shield = Initial.shield;
        !            42:        Status.crew = Initial.crew;
        !            43:        Status.brigfree = Initial.brigfree;
        !            44:        Status.shldup = 0;
        !            45:        Status.cloaked = 0;
        !            46:        Status.cond = DOCKED;
        !            47:        Status.reserves = Initial.reserves;
        !            48:        Status.sinsbad = 0;
        !            49:        dumpssradio();
        !            50:        /* reschedule any device repairs */
        !            51:        for (i = 0; i < MAXEVENTS; i++)
        !            52:        {
        !            53:                e = &Event[i];
        !            54:                if (e->evcode != E_FIXDV)
        !            55:                        continue;
        !            56:                reschedule(e, (Status.date - e->date)*(1 - Param.dockfac));
        !            57:        }
        !            58:        return;
        !            59: }
        !            60: 
        !            61: 
        !            62: /**
        !            63:  **    leave a starbase
        !            64:  **/
        !            65: 
        !            66: undock()
        !            67: {
        !            68:        register EVENT          *e;
        !            69:        register int            i;
        !            70: 
        !            71:        if (Status.cond != DOCKED)
        !            72:        {
        !            73:                printf("Sulu: Pardon me captain, but we are not docked.\n");
        !            74:                return;
        !            75:        }
        !            76:        Status.cond = GREEN;
        !            77:        Move.free = 0;
        !            78:        /* reschedule device repair times (again) */
        !            79:        for (i = 0; i < MAXEVENTS; i++)
        !            80:        {
        !            81:                e = &Event[i];
        !            82:                if (e->evcode != E_FIXDV)
        !            83:                        continue;
        !            84:                reschedule(e, (Status.date - e->date)*(1 - 1 / Param.dockfac));
        !            85:        }
        !            86:        return;
        !            87: }

unix.superglobalmegacorp.com

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