1*11674Smckusick #ifndef lint 2*11674Smckusick static char sccsid[] = "@(#)getcodi.c 4.1 (Berkeley) 03/23/83"; 3*11674Smckusick #endif not lint 4*11674Smckusick 5*11674Smckusick # include "getpar.h" 6*11674Smckusick 7*11674Smckusick /* 8*11674Smckusick ** get course and distance 9*11674Smckusick ** 10*11674Smckusick ** The user is asked for a course and distance. This is used by 11*11674Smckusick ** move, impulse, and some of the computer functions. 12*11674Smckusick ** 13*11674Smckusick ** The return value is zero for success, one for an invalid input 14*11674Smckusick ** (meaning to drop the request). 15*11674Smckusick */ 16*11674Smckusick 17*11674Smckusick getcodi(co, di) 18*11674Smckusick int *co; 19*11674Smckusick float *di; 20*11674Smckusick { 21*11674Smckusick 22*11674Smckusick *co = getintpar("Course"); 23*11674Smckusick 24*11674Smckusick /* course must be in the interval [0, 360] */ 25*11674Smckusick if (*co < 0 || *co > 360) 26*11674Smckusick return (1); 27*11674Smckusick *di = getfltpar("Distance"); 28*11674Smckusick 29*11674Smckusick /* distance must be in the interval [0, 15] */ 30*11674Smckusick if (*di <= 0.0 || *di > 15.0) 31*11674Smckusick return (1); 32*11674Smckusick 33*11674Smckusick /* good return */ 34*11674Smckusick return (0); 35*11674Smckusick } 36