Complete.Org: Mailing Lists: Archives: freeciv-dev: January 1999:
[Freeciv-Dev] init_warmap
Home

[Freeciv-Dev] init_warmap

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] init_warmap
From: Nicolas BRUNEL <brunel@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 30 Jan 1999 00:13:41 +0100 (CET)

Hello,

        init_warmap is a function in gotohand which takes lot of time.
I wiped out some ligns and goto works fine and faster.
Now i have 2 things to ask :
        - what was this threshold usefull to ?
        - can another one test if if works fine on a large game with lots
of ai players ?

Index: server/gotohand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gotohand.c,v
retrieving revision 1.27
diff -u -r1.27 gotohand.c
--- gotohand.c  1999/01/28 17:26:10     1.27
+++ gotohand.c  1999/01/29 21:52:07
@@ -67,6 +67,7 @@
 {
   int x, y, i, j;
   int maxcost = THRESHOLD * 6 + 2; /* should be big enough without being TOO 
big */
+  /*
   for (x = 0; x < map.xsize; x++) {
     if (x > orig_x)
       i = MIN(x - orig_x, orig_x + map.xsize - x);
@@ -77,13 +78,14 @@
         j = MAX(y - orig_y, i);
       else
         j = MAX(orig_y - y, i);
-      j *= 3; /* can be speed up */
+      j *= 3;
       if (j < maxcost) j = maxcost;
-      if (j > 255) j = 255;
-      if (which == LAND_MOVING) warmap.cost[x][y] = j; /* one if by land */
-      else warmap.seacost[x][y] = j;
-    }
-  }
+      if (j > 255) j = 255; */
+      for(x=0; x < map.xsize;x++)
+      for(y=0; y < map.ysize;y++) 
+      if (which == LAND_MOVING) warmap.cost[x][y] = 255; /* one if by land */
+      else warmap.seacost[x][y] = 255;
+
   if (which == LAND_MOVING) warmap.cost[orig_x][orig_y] = 0;
   else warmap.seacost[orig_x][orig_y] = 0;
 }  
 

 Nicolas Brunel
 LIM Case 901, 
 163 Avenue de Luminy             brunel@xxxxxxxxxxxxxxx
 13288 Marseille Cedex 9  France  tel +33 04 9182 (8524) fax 9275



[Prev in Thread] Current Thread [Next in Thread]