1 /* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)getcodi.c 8.1 (Berkeley) 05/31/93"; 10 #endif /* not lint */ 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; 26 double *di; 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 } 43