diff options
Diffstat (limited to 'games/trek/compkl.c')
-rw-r--r-- | games/trek/compkl.c | 18 |
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; } } |