xref: /csrg-svn/games/trek/getcodi.c (revision 60857)
121280Sdist /*
2*60857Sbostic  * Copyright (c) 1980, 1993
3*60857Sbostic  *	The Regents of the University of California.  All rights reserved.
434205Sbostic  *
542605Sbostic  * %sccs.include.redist.c%
621280Sdist  */
721280Sdist 
811674Smckusick #ifndef lint
9*60857Sbostic static char sccsid[] = "@(#)getcodi.c	8.1 (Berkeley) 05/31/93";
1034205Sbostic #endif /* not lint */
1111674Smckusick 
1211674Smckusick # include	"getpar.h"
1311674Smckusick 
1411674Smckusick /*
1511674Smckusick **  get course and distance
1611674Smckusick **
1711674Smckusick **	The user is asked for a course and distance.  This is used by
1811674Smckusick **	move, impulse, and some of the computer functions.
1911674Smckusick **
2011674Smckusick **	The return value is zero for success, one for an invalid input
2111674Smckusick **	(meaning to drop the request).
2211674Smckusick */
2311674Smckusick 
getcodi(co,di)2411674Smckusick getcodi(co, di)
2511674Smckusick int	*co;
2612738Slayer double	*di;
2711674Smckusick {
2811674Smckusick 
2911674Smckusick 	*co = getintpar("Course");
3011674Smckusick 
3111674Smckusick 	/* course must be in the interval [0, 360] */
3211674Smckusick 	if (*co < 0 || *co > 360)
3311674Smckusick 		return (1);
3411674Smckusick 	*di = getfltpar("Distance");
3511674Smckusick 
3611674Smckusick 	/* distance must be in the interval [0, 15] */
3711674Smckusick 	if (*di <= 0.0 || *di > 15.0)
3811674Smckusick 		return (1);
3911674Smckusick 
4011674Smckusick 	/* good return */
4111674Smckusick 	return (0);
4211674Smckusick }
43