121265Sdist /* 2*60857Sbostic * Copyright (c) 1980, 1993 3*60857Sbostic * The Regents of the University of California. All rights reserved. 434205Sbostic * 542605Sbostic * %sccs.include.redist.c% 621265Sdist */ 721265Sdist 811658Smckusick #ifndef lint 9*60857Sbostic static char sccsid[] = "@(#)autover.c 8.1 (Berkeley) 05/31/93"; 1034205Sbostic #endif /* not lint */ 1111658Smckusick 1211658Smckusick # include "trek.h" 1311658Smckusick 1411658Smckusick /* 1511658Smckusick ** Automatic Override 1611658Smckusick ** 1711658Smckusick ** If we should be so unlucky as to be caught in a quadrant 1811658Smckusick ** with a supernova in it, this routine is called. It is 1911658Smckusick ** called from checkcond(). 2011658Smckusick ** 2111658Smckusick ** It sets you to a random warp (guaranteed to be over 6.0) 2211658Smckusick ** and starts sending you off "somewhere" (whereever that is). 2311658Smckusick ** 2411658Smckusick ** Please note that it is VERY important that you reset your 2511658Smckusick ** warp speed after the automatic override is called. The new 2611658Smckusick ** warp factor does not stay in effect for just this routine. 2711658Smckusick ** 2811658Smckusick ** This routine will never try to send you more than sqrt(2) 2911658Smckusick ** quadrants, since that is all that is needed. 3011658Smckusick */ 3111658Smckusick autover()3211658Smckusickautover() 3311658Smckusick { 3412737Slayer double dist; 3511658Smckusick register int course; 3611658Smckusick 3734712Sbostic printf("\07RED ALERT: The %s is in a supernova quadrant\n", Ship.shipname); 3811658Smckusick printf("*** Emergency override attempts to hurl %s to safety\n", Ship.shipname); 3911658Smckusick /* let's get our ass out of here */ 4011658Smckusick Ship.warp = 6.0 + 2.0 * franf(); 4111658Smckusick Ship.warp2 = Ship.warp * Ship.warp; 4211658Smckusick Ship.warp3 = Ship.warp2 * Ship.warp; 4311658Smckusick dist = 0.75 * Ship.energy / (Ship.warp3 * (Ship.shldup + 1)); 4411658Smckusick if (dist > 1.4142) 4511658Smckusick dist = 1.4142; 4611658Smckusick course = ranf(360); 4711658Smckusick Etc.nkling = -1; 4811658Smckusick Ship.cond = RED; 4911658Smckusick warp(-1, course, dist); 5011658Smckusick attack(0); 5111658Smckusick } 52