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