Commit | Line | Data |
---|---|---|
b6f0a7e4 DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
e9fb6bea KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
d99e6414 KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
b6f0a7e4 DF |
16 | */ |
17 | ||
ba6edf6a | 18 | #ifndef lint |
d99e6414 | 19 | static char sccsid[] = "@(#)dumpme.c 5.3 (Berkeley) %G%"; |
e9fb6bea | 20 | #endif /* not lint */ |
ba6edf6a KM |
21 | |
22 | # include "trek.h" | |
23 | ||
24 | /* | |
25 | ** Dump the starship somewhere in the galaxy | |
26 | ** | |
27 | ** Parameter is zero if bounce off of negative energy barrier, | |
28 | ** one if through a black hole | |
29 | ** | |
30 | ** Note that the quadrant is NOT initialized here. This must | |
31 | ** be done from the calling routine. | |
32 | ** | |
33 | ** Repair of devices must be deferred. | |
34 | */ | |
35 | ||
36 | dumpme(flag) | |
37 | int flag; | |
38 | { | |
39 | register int f; | |
40 | double x; | |
41 | register struct event *e; | |
42 | register int i; | |
43 | ||
44 | f = flag; | |
45 | Ship.quadx = ranf(NQUADS); | |
46 | Ship.quady = ranf(NQUADS); | |
47 | Ship.sectx = ranf(NSECTS); | |
48 | Ship.secty = ranf(NSECTS); | |
35b95499 KL |
49 | x += 1.5 * franf(); |
50 | Move.time += x; | |
ba6edf6a KM |
51 | if (f) |
52 | { | |
53 | printf("%s falls into a black hole.\n", Ship.shipname); | |
54 | } | |
55 | else | |
56 | { | |
57 | printf("Computer applies full reverse power to avoid hitting the\n"); | |
58 | printf(" negative energy barrier. A space warp was entered.\n"); | |
59 | } | |
60 | /* bump repair dates forward */ | |
61 | for (i = 0; i < MAXEVENTS; i++) | |
62 | { | |
63 | e = &Event[i]; | |
64 | if (e->evcode != E_FIXDV) | |
65 | continue; | |
66 | reschedule(e, (e->date - Now.date) + x); | |
67 | } | |
68 | events(1); | |
69 | printf("You are now in quadrant %d,%d. It is stardate %.2f\n", | |
70 | Ship.quadx, Ship.quady, Now.date); | |
71 | Move.time = 0; | |
72 | } |