xref: /csrg-svn/games/trek/getcodi.c (revision 12738)
111674Smckusick #ifndef lint
2*12738Slayer static char sccsid[] = "@(#)getcodi.c	4.2	(Berkeley)	05/27/83";
311674Smckusick #endif not lint
411674Smckusick 
511674Smckusick # include	"getpar.h"
611674Smckusick 
711674Smckusick /*
811674Smckusick **  get course and distance
911674Smckusick **
1011674Smckusick **	The user is asked for a course and distance.  This is used by
1111674Smckusick **	move, impulse, and some of the computer functions.
1211674Smckusick **
1311674Smckusick **	The return value is zero for success, one for an invalid input
1411674Smckusick **	(meaning to drop the request).
1511674Smckusick */
1611674Smckusick 
1711674Smckusick getcodi(co, di)
1811674Smckusick int	*co;
19*12738Slayer double	*di;
2011674Smckusick {
2111674Smckusick 
2211674Smckusick 	*co = getintpar("Course");
2311674Smckusick 
2411674Smckusick 	/* course must be in the interval [0, 360] */
2511674Smckusick 	if (*co < 0 || *co > 360)
2611674Smckusick 		return (1);
2711674Smckusick 	*di = getfltpar("Distance");
2811674Smckusick 
2911674Smckusick 	/* distance must be in the interval [0, 15] */
3011674Smckusick 	if (*di <= 0.0 || *di > 15.0)
3111674Smckusick 		return (1);
3211674Smckusick 
3311674Smckusick 	/* good return */
3411674Smckusick 	return (0);
3511674Smckusick }
36