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