Date:	Tuesday August 15, 2000 @ 2:57
Author:	xyzzy

Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv7261

Modified Files:
	wander2.c 
Log Message:
Clean up some crufty code.  Remove a few global variables and make all others
static.


****************************************

Index: Vanilla/ntserv/wander2.c
diff -u Vanilla/ntserv/wander2.c:1.2 Vanilla/ntserv/wander2.c:1.3
--- Vanilla/ntserv/wander2.c:1.2	Fri Apr 30 15:18:47 1999
+++ Vanilla/ntserv/wander2.c	Tue Aug 15 02:57:58 2000
@@ -7,29 +7,22 @@
 #define COS(x) ((x) >= 0.0 ? Cosine[(int)(x)] : Cosine[(int)(-(x))])
 #define SIN(x) ((x) >= 0.0 ? Sine[(int)(x)] : -Sine[(int)(-(x))])
 
-int pl_home[4];
-int pl_core[4][10];
-int pl_dist[4][10];
-double increment = 0.016;
-double incrementrecip = 62.5;
-float *Cosine, *Sine;
+static int pl_home[4];
+static int pl_core[4][10];
+static int pl_dist[4][10];
+static const double increment = 0.016;
+static const double incrementrecip = 62.5;
+static float *Cosine, *Sine;
 
-double dpre;
-
-int planeti, planetj;
-
 /* call only once */
 void pinit(void)
 {
-    double dx, dy;
     int i, j;
-
     int pre;
 
     void pmove();
 
     pre = 3.5/increment;
-    dpre = (double) pre;
 
     Cosine = (float*) calloc(sizeof(float), pre);
     Sine = (float*) calloc(sizeof(float), pre);
@@ -61,21 +54,18 @@
     
     for (i = 0; i < 4; i++) {
 	for (j = 0; j < 4; j++) {
-	    dx = (double) (planets[pl_core[i][j]].pl_x - planets[pl_home[i]].pl_x);
-	    dy = (double) (planets[pl_home[i]].pl_y - planets[pl_core[i][j]].pl_y);
-	    pl_dist[i][j] = sqrt(dx * dx + dy * dy);
-/*	    pl_dist[i][j] = 12000;*/
+	    pl_dist[i][j] = hypot(
+		planets[pl_core[i][j]].pl_x - planets[pl_home[i]].pl_x,
+		planets[pl_core[i][j]].pl_y - planets[pl_home[i]].pl_y);
 	}
     }
-
-    planeti = 0;
-    planetj = 0;
 }
 
 void pmove(void)
 {
     int i, j;
     double dir;
+    static int planeti=0, planetj=0;
 
     for (i = 0; i < 4; i++) {
 	for (j = 0; j < 4; j++) {