summaryrefslogtreecommitdiff
path: root/games/trek/compkl.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/compkl.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/compkl.c')
-rw-r--r--games/trek/compkl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/games/trek/compkl.c b/games/trek/compkl.c
index 4aa0f056c5f..eac12ad0b6c 100644
--- a/games/trek/compkl.c
+++ b/games/trek/compkl.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: compkl.c,v 1.2 1998/08/19 07:41:18 pjanzen Exp $ */
/* $NetBSD: compkl.c,v 1.3 1995/04/22 10:58:38 cgd Exp $ */
/*
@@ -37,11 +38,12 @@
#if 0
static char sccsid[] = "@(#)compkl.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: compkl.c,v 1.3 1995/04/22 10:58:38 cgd Exp $";
+static char rcsid[] = "$OpenBSD: compkl.c,v 1.2 1998/08/19 07:41:18 pjanzen Exp $";
#endif
#endif /* not lint */
-# include "trek.h"
+#include <math.h>
+#include "trek.h"
/*
** compute klingon distances
@@ -54,8 +56,11 @@ static char rcsid[] = "$NetBSD: compkl.c,v 1.3 1995/04/22 10:58:38 cgd Exp $";
** move.
*/
+static void sortkl __P((void));
+
+void
compkldist(f)
-int f; /* set if new quadrant */
+ int f; /* set if new quadrant */
{
register int i, dx, dy;
double d;
@@ -96,6 +101,7 @@ int f; /* set if new quadrant */
** bubble sort on ascending distance
*/
+static void
sortkl()
{
struct kling t;
@@ -109,9 +115,9 @@ sortkl()
for (i = 0; i < m; i++)
if (Etc.klingon[i].dist > Etc.klingon[i+1].dist)
{
- bmove(&Etc.klingon[i], &t, sizeof t);
- bmove(&Etc.klingon[i+1], &Etc.klingon[i], sizeof t);
- bmove(&t, &Etc.klingon[i+1], sizeof t);
+ t = Etc.klingon[i];
+ Etc.klingon[i] = Etc.klingon[i + 1];
+ Etc.klingon[i + 1] = t;
f = 1;
}
}