BSD 1 development
[unix-history] / trek / dumpme.c
CommitLineData
520d5775
EA
1# include "trek.h"
2
3/*
4** Dump the starship somewhere in the galaxy
5**
6** Parameter is zero if bounce off of negative energy barrier,
7** one if through a black hole
8**
9** Note that the quadrant is NOT initialized here. This must
10** be done from the calling routine.
11**
12** Repair of devices must be deferred.
13*/
14
15dumpme(flag)
16int flag;
17{
18 register int f;
19 double x;
20 register struct event *e;
21 register int i;
22
23 f = flag;
24 Ship.quadx = ranf(NQUADS);
25 Ship.quady = ranf(NQUADS);
26 Ship.sectx = ranf(NSECTS);
27 Ship.secty = ranf(NSECTS);
28 x =+ 1.5 * franf();
29 Move.time =+ x;
30 if (f)
31 {
32 printf("%s falls into a black hole.\n", Ship.shipname);
33 }
34 else
35 {
36 printf("Computer applies full reverse power to avoid hitting the\n");
37 printf(" negative energy barrier. A space warp was entered.\n");
38 }
39 /* bump repair dates forward */
40 for (i = 0; i < MAXEVENTS; i++)
41 {
42 e = &Event[i];
43 if (e->evcode != E_FIXDV)
44 continue;
45 reschedule(e, (e->date - Now.date) + x);
46 }
47 events(1);
48 printf("You are now in quadrant %d,%d. It is stardate %.2f\n",
49 Ship.quadx, Ship.quady, Now.date);
50 Move.time = 0;
51}