]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/computer.c
Correct spelling of "delimiter", and remove from ignored-errors lists.
[bsdgames-darwin.git] / trek / computer.c
index 3c8fa3c55d1003ec35a71bbc23e4614aa46be597..d7bf7ea668216061efa4254489ab9a8095077293 100644 (file)
@@ -1,6 +1,8 @@
+/*     $NetBSD: computer.c,v 1.8 2000/07/03 03:57:44 matt 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
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
 #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.8 2000/07/03 03:57:44 matt Exp $");
+#endif
 #endif /* not lint */
 
-# include      "trek.h"
-# include      "getpar.h"
-# include      <stdio.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
+
 /*
 **  On-Board Computer
 **
@@ -87,38 +96,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 __P((int, int, int, int, double *));
+static void prkalc __P((int, double));
+
+/*ARGSUSED*/
+void
+computer(v)
+       int v __attribute__((__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 +320,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 +331,7 @@ double      *dist;
        double                  dx, dy;
        double                  quadsize;
        double                  angle;
-       register int            course;
+       int             course;
 
        /* normalize to quadrant distances */
        quadsize = NSECTS;
@@ -335,7 +350,7 @@ double      *dist;
        return (course);
 }
 
-
+static void
 prkalc(course, dist)
 int    course;
 double dist;