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