Annotation of 43BSD/games/trek/autover.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[] = "@(#)autover.c  5.1 (Berkeley) 5/30/85";
                      9: #endif not lint
                     10: 
                     11: # include      "trek.h"
                     12: 
                     13: /*
                     14: **  Automatic Override
                     15: **
                     16: **     If we should be so unlucky as to be caught in a quadrant
                     17: **     with a supernova in it, this routine is called.  It is
                     18: **     called from checkcond().
                     19: **
                     20: **     It sets you to a random warp (guaranteed to be over 6.0)
                     21: **     and starts sending you off "somewhere" (whereever that is).
                     22: **
                     23: **     Please note that it is VERY important that you reset your
                     24: **     warp speed after the automatic override is called.  The new
                     25: **     warp factor does not stay in effect for just this routine.
                     26: **
                     27: **     This routine will never try to send you more than sqrt(2)
                     28: **     quadrants, since that is all that is needed.
                     29: */
                     30: 
                     31: autover()
                     32: {
                     33:        double                  dist;
                     34:        register int            course;
                     35: 
                     36:        printf("RED ALERT:  The %s is in a supernova quadrant\n", Ship.shipname);
                     37:        printf("***  Emergency override attempts to hurl %s to safety\n", Ship.shipname);
                     38:        /* let's get our ass out of here */
                     39:        Ship.warp = 6.0 + 2.0 * franf();
                     40:        Ship.warp2 = Ship.warp * Ship.warp;
                     41:        Ship.warp3 = Ship.warp2 * Ship.warp;
                     42:        dist = 0.75 * Ship.energy / (Ship.warp3 * (Ship.shldup + 1));
                     43:        if (dist > 1.4142)
                     44:                dist = 1.4142;
                     45:        course = ranf(360);
                     46:        Etc.nkling = -1;
                     47:        Ship.cond = RED;
                     48:        warp(-1, course, dist);
                     49:        attack(0);
                     50: }

unix.superglobalmegacorp.com

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