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