summaryrefslogtreecommitdiff
path: root/games/trek/computer.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-19 07:42:28 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-19 07:42:28 +0000
commited884b9fa4509c09f0f7ab71efe57a4e83a2e055 (patch)
treeef9d859a0754785b42ea5cacb27aff54b5000315 /games/trek/computer.c
parentf4fc9566a4d35c0cc2bf8c7f1136287d8eec8c44 (diff)
tags, formatting, ANSI-fication, prototypes, de-typos, and the occasional
initialization, removal of unused variable, or other minor fix. Most changes are from or inspired by NetBSD.
Diffstat (limited to 'games/trek/computer.c')
-rw-r--r--games/trek/computer.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/games/trek/computer.c b/games/trek/computer.c
index dbf5e614291..c036a1f592f 100644
--- a/games/trek/computer.c
+++ b/games/trek/computer.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: computer.c,v 1.2 1998/08/19 07:41:20 pjanzen Exp $ */
/* $NetBSD: computer.c,v 1.4 1995/04/24 12:25:51 cgd Exp $ */
/*
@@ -37,13 +38,15 @@
#if 0
static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: computer.c,v 1.4 1995/04/24 12:25:51 cgd Exp $";
+static char rcsid[] = "$OpenBSD: computer.c,v 1.2 1998/08/19 07:41:20 pjanzen Exp $";
#endif
#endif /* not lint */
-# include "trek.h"
-# include "getpar.h"
-# include <stdio.h>
+#include <stdio.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
+
/*
** On-Board Computer
**
@@ -92,23 +95,27 @@ static char rcsid[] = "$NetBSD: computer.c,v 1.4 1995/04/24 12:25:51 cgd 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));
+
+void
+computer(v)
+ int v;
{
int ix, iy;
register int i, j;
- int numout;
int tqx, tqy;
struct cvntab *r;
int cost;
@@ -146,10 +153,12 @@ computer()
q = &Quad[i][j];
/* 1000 or 1001 is special case */
if (q->scanned >= 1000)
+ {
if (q->scanned > 1000)
printf(".1. ");
else
printf("/// ");
+ }
else
if (q->scanned < 0)
printf("... ");
@@ -311,12 +320,13 @@ computer()
** sqx,sqy/ssx,ssy to tqx,tqy/tsx,tsy.
*/
+static int
kalc(tqx, tqy, tsx, tsy, dist)
-int tqx;
-int tqy;
-int tsx;
-int tsy;
-double *dist;
+ int tqx;
+ int tqy;
+ int tsx;
+ int tsy;
+ double *dist;
{
double dx, dy;
double quadsize;
@@ -340,10 +350,10 @@ double *dist;
return (course);
}
-
+static void
prkalc(course, dist)
-int course;
-double dist;
+ int course;
+ double dist;
{
printf(": course %d dist %.3f\n", course, dist);
}