xref: /csrg-svn/games/trek/dumpme.c (revision 60857)
121276Sdist /*
2*60857Sbostic  * Copyright (c) 1980, 1993
3*60857Sbostic  *	The Regents of the University of California.  All rights reserved.
434205Sbostic  *
542605Sbostic  * %sccs.include.redist.c%
621276Sdist  */
721276Sdist 
811670Smckusick #ifndef lint
9*60857Sbostic static char sccsid[] = "@(#)dumpme.c	8.1 (Berkeley) 05/31/93";
1034205Sbostic #endif /* not lint */
1111670Smckusick 
1211670Smckusick # include	"trek.h"
1311670Smckusick 
1411670Smckusick /*
1511670Smckusick **  Dump the starship somewhere in the galaxy
1611670Smckusick **
1711670Smckusick **	Parameter is zero if bounce off of negative energy barrier,
1811670Smckusick **	one if through a black hole
1911670Smckusick **
2011670Smckusick **	Note that the quadrant is NOT initialized here.  This must
2111670Smckusick **	be done from the calling routine.
2211670Smckusick **
2311670Smckusick **	Repair of devices must be deferred.
2411670Smckusick */
2511670Smckusick 
dumpme(flag)2611670Smckusick dumpme(flag)
2711670Smckusick int	flag;
2811670Smckusick {
2911670Smckusick 	register int		f;
3011670Smckusick 	double			x;
3111670Smckusick 	register struct event	*e;
3211670Smckusick 	register int		i;
3311670Smckusick 
3411670Smckusick 	f = flag;
3511670Smckusick 	Ship.quadx = ranf(NQUADS);
3611670Smckusick 	Ship.quady = ranf(NQUADS);
3711670Smckusick 	Ship.sectx = ranf(NSECTS);
3811670Smckusick 	Ship.secty = ranf(NSECTS);
3912344Slayer 	x += 1.5 * franf();
4012344Slayer 	Move.time += x;
4111670Smckusick 	if (f)
4211670Smckusick 	{
4311670Smckusick 		printf("%s falls into a black hole.\n", Ship.shipname);
4411670Smckusick 	}
4511670Smckusick 	else
4611670Smckusick 	{
4711670Smckusick 		printf("Computer applies full reverse power to avoid hitting the\n");
4811670Smckusick 		printf("   negative energy barrier.  A space warp was entered.\n");
4911670Smckusick 	}
5011670Smckusick 	/* bump repair dates forward */
5111670Smckusick 	for (i = 0; i < MAXEVENTS; i++)
5211670Smckusick 	{
5311670Smckusick 		e = &Event[i];
5411670Smckusick 		if (e->evcode != E_FIXDV)
5511670Smckusick 			continue;
5611670Smckusick 		reschedule(e, (e->date - Now.date) + x);
5711670Smckusick 	}
5811670Smckusick 	events(1);
5911670Smckusick 	printf("You are now in quadrant %d,%d.  It is stardate %.2f\n",
6011670Smckusick 		Ship.quadx, Ship.quady, Now.date);
6111670Smckusick 	Move.time = 0;
6211670Smckusick }
63