removed support for -r, -h, and rmail
[unix-history] / usr / src / games / trek / dumpme.c
CommitLineData
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
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
b6f0a7e4
DF
11 */
12
ba6edf6a 13#ifndef lint
e9fb6bea
KB
14static char sccsid[] = "@(#)dumpme.c 5.2 (Berkeley) %G%";
15#endif /* not lint */
ba6edf6a
KM
16
17# include "trek.h"
18
19/*
20** Dump the starship somewhere in the galaxy
21**
22** Parameter is zero if bounce off of negative energy barrier,
23** one if through a black hole
24**
25** Note that the quadrant is NOT initialized here. This must
26** be done from the calling routine.
27**
28** Repair of devices must be deferred.
29*/
30
31dumpme(flag)
32int flag;
33{
34 register int f;
35 double x;
36 register struct event *e;
37 register int i;
38
39 f = flag;
40 Ship.quadx = ranf(NQUADS);
41 Ship.quady = ranf(NQUADS);
42 Ship.sectx = ranf(NSECTS);
43 Ship.secty = ranf(NSECTS);
35b95499
KL
44 x += 1.5 * franf();
45 Move.time += x;
ba6edf6a
KM
46 if (f)
47 {
48 printf("%s falls into a black hole.\n", Ship.shipname);
49 }
50 else
51 {
52 printf("Computer applies full reverse power to avoid hitting the\n");
53 printf(" negative energy barrier. A space warp was entered.\n");
54 }
55 /* bump repair dates forward */
56 for (i = 0; i < MAXEVENTS; i++)
57 {
58 e = &Event[i];
59 if (e->evcode != E_FIXDV)
60 continue;
61 reschedule(e, (e->date - Now.date) + x);
62 }
63 events(1);
64 printf("You are now in quadrant %d,%d. It is stardate %.2f\n",
65 Ship.quadx, Ship.quady, Now.date);
66 Move.time = 0;
67}