Commit | Line | Data |
---|---|---|
b6f0a7e4 | 1 | /* |
82daddb0 KB |
2 | * Copyright (c) 1980, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
e9fb6bea | 4 | * |
b2e7427f | 5 | * %sccs.include.redist.c% |
b6f0a7e4 DF |
6 | */ |
7 | ||
6736ce78 | 8 | #ifndef lint |
82daddb0 | 9 | static char sccsid[] = "@(#)getcodi.c 8.1 (Berkeley) %G%"; |
e9fb6bea | 10 | #endif /* not lint */ |
6736ce78 KM |
11 | |
12 | # include "getpar.h" | |
13 | ||
14 | /* | |
15 | ** get course and distance | |
16 | ** | |
17 | ** The user is asked for a course and distance. This is used by | |
18 | ** move, impulse, and some of the computer functions. | |
19 | ** | |
20 | ** The return value is zero for success, one for an invalid input | |
21 | ** (meaning to drop the request). | |
22 | */ | |
23 | ||
24 | getcodi(co, di) | |
25 | int *co; | |
06d69904 | 26 | double *di; |
6736ce78 KM |
27 | { |
28 | ||
29 | *co = getintpar("Course"); | |
30 | ||
31 | /* course must be in the interval [0, 360] */ | |
32 | if (*co < 0 || *co > 360) | |
33 | return (1); | |
34 | *di = getfltpar("Distance"); | |
35 | ||
36 | /* distance must be in the interval [0, 15] */ | |
37 | if (*di <= 0.0 || *di > 15.0) | |
38 | return (1); | |
39 | ||
40 | /* good return */ | |
41 | return (0); | |
42 | } |