X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/462fca95471224f85b85be911e72faee16cd1597..e68df2be2d86409745cee75571833732bdd20c9a:/trek/computer.c diff --git a/trek/computer.c b/trek/computer.c index 3c8fa3c5..a470cc47 100644 --- a/trek/computer.c +++ b/trek/computer.c @@ -1,6 +1,8 @@ +/* $NetBSD: computer.c,v 1.11 2007/12/15 19:44:44 perry Exp $ */ + /* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,14 +29,21 @@ * SUCH DAMAGE. */ +#include #ifndef lint -/*static char sccsid[] = "from: @(#)computer.c 4.8 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$Id: computer.c,v 1.2 1993/08/01 18:50:46 mycroft Exp $"; +#if 0 +static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: computer.c,v 1.11 2007/12/15 19:44:44 perry Exp $"); +#endif #endif /* not lint */ -# include "trek.h" -# include "getpar.h" -# include +#include +#include +#include +#include "trek.h" +#include "getpar.h" + /* ** On-Board Computer ** @@ -87,38 +92,43 @@ static char rcsid[] = "$Id: computer.c,v 1.2 1993/08/01 18:50:46 mycroft Exp $"; struct cvntab Cputab[] = { - "ch", "art", (int (*)())1, 0, - "t", "rajectory", (int (*)())2, 0, - "c", "ourse", (int (*)())3, 0, - "m", "ove", (int (*)())3, 1, - "s", "core", (int (*)())4, 0, - "p", "heff", (int (*)())5, 0, - "w", "arpcost", (int (*)())6, 0, - "i", "mpcost", (int (*)())7, 0, - "d", "istresslist", (int (*)())8, 0, - 0 + { "ch", "art", (cmdfun)1, 0 }, + { "t", "rajectory", (cmdfun)2, 0 }, + { "c", "ourse", (cmdfun)3, 0 }, + { "m", "ove", (cmdfun)3, 1 }, + { "s", "core", (cmdfun)4, 0 }, + { "p", "heff", (cmdfun)5, 0 }, + { "w", "arpcost", (cmdfun)6, 0 }, + { "i", "mpcost", (cmdfun)7, 0 }, + { "d", "istresslist", (cmdfun)8, 0 }, + { NULL, NULL, NULL, 0 } }; -computer() +static int kalc(int, int, int, int, double *); +static void prkalc(int, double); + +/*ARGSUSED*/ +void +computer(v) + int v __unused; { - int ix, iy; - register int i, j; - int numout; - int tqx, tqy; - struct cvntab *r; - int cost; - int course; - double dist, time; - double warpfact; - struct quad *q; - register struct event *e; + int ix, iy; + int i, j; + int tqx, tqy; + const struct cvntab *r; + int cost; + int course; + double dist, time; + double warpfact; + struct quad *q; + struct event *e; if (check_out(COMPUTER)) return; while (1) { r = getcodpar("\nRequest", Cputab); - switch ((int)r->value) + switch ((long)r->value) { case 1: /* star chart */ @@ -306,6 +316,7 @@ computer() ** sqx,sqy/ssx,ssy to tqx,tqy/tsx,tsy. */ +static int kalc(tqx, tqy, tsx, tsy, dist) int tqx; int tqy; @@ -316,7 +327,7 @@ double *dist; double dx, dy; double quadsize; double angle; - register int course; + int course; /* normalize to quadrant distances */ quadsize = NSECTS; @@ -335,7 +346,7 @@ double *dist; return (course); } - +static void prkalc(course, dist) int course; double dist;