BSD 4_3 release
[unix-history] / usr / src / games / trek / getcodi.c
CommitLineData
b6f0a7e4
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
6736ce78 7#ifndef lint
95f51977 8static char sccsid[] = "@(#)getcodi.c 5.1 (Berkeley) 5/30/85";
6736ce78
KM
9#endif not lint
10
11# include "getpar.h"
12
13/*
14** get course and distance
15**
16** The user is asked for a course and distance. This is used by
17** move, impulse, and some of the computer functions.
18**
19** The return value is zero for success, one for an invalid input
20** (meaning to drop the request).
21*/
22
23getcodi(co, di)
24int *co;
06d69904 25double *di;
6736ce78
KM
26{
27
28 *co = getintpar("Course");
29
30 /* course must be in the interval [0, 360] */
31 if (*co < 0 || *co > 360)
32 return (1);
33 *di = getfltpar("Distance");
34
35 /* distance must be in the interval [0, 15] */
36 if (*di <= 0.0 || *di > 15.0)
37 return (1);
38
39 /* good return */
40 return (0);
41}