Fix two problems with movemap code

Per Inge Mathisen <per-0/[email protected]> Mon, 21 Mar 2005 13:36:56 +0000 (GMT)
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
I did two copy&paste mistakes when adding in the movemap code. This patch
fixes it, and also adds a timing log. Committed.

  - Per
movemapfix.diff (text/plain, 2.5 KB)
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.59
diff -u -r1.59 aidata.c
--- ai/aidata.c	19 Mar 2005 15:34:18 -0000	1.59
+++ ai/aidata.c	21 Mar 2005 13:35:58 -0000
@@ -168,6 +168,8 @@
 **************************************************************************/
 void ai_data_movemap_recalculate(void)
 {
+  TIMING_LOG(LOG_DEBUG, NULL, "Generating movemap");
+
   /* Clean the slate */
   whole_map_iterate(ptile) {
     unsigned int r;
Index: ai/ailog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/ailog.c,v
retrieving revision 1.20
diff -u -r1.20 ailog.c
--- ai/ailog.c	20 Mar 2005 09:08:48 -0000	1.20
+++ ai/ailog.c	21 Mar 2005 13:35:58 -0000
@@ -271,7 +271,7 @@
   }
 
   my_snprintf(buffer, sizeof(buffer), "... %g seconds. %s: ",
-              read_timer_seconds(t), pplayer->name);
+              read_timer_seconds(t), pplayer ? pplayer->name : "(all)");
   clear_timer_start(t);
   cat_snprintf(buffer, sizeof(buffer), msg);
   if (srvarg.timing_debug) {
Index: common/aicore/pf_tools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/pf_tools.c,v
retrieving revision 1.26
diff -u -r1.26 pf_tools.c
--- common/aicore/pf_tools.c	14 Mar 2005 20:26:25 -0000	1.26
+++ common/aicore/pf_tools.c	21 Mar 2005 13:35:58 -0000
@@ -525,7 +525,8 @@
     break;
   case AIR_MOVING:
   case HELI_MOVING:
-    die("Unsupported move_type");
+    parameter->get_MC = single_airmove; /* very crude */
+    break;
   }
 
   parameter->get_zoc = NULL;
@@ -555,7 +556,8 @@
     break;
   case AIR_MOVING:
   case HELI_MOVING:
-    die("Unsupported move_type");
+    parameter->get_MC = single_airmove; /* very crude */
+    break;
   }
 
   if (unit_type(punit)->move_type == LAND_MOVING 
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.234
diff -u -r1.234 srv_main.c
--- server/srv_main.c	20 Mar 2005 09:08:48 -0000	1.234
+++ server/srv_main.c	21 Mar 2005 13:35:59 -0000
@@ -517,7 +517,7 @@
   freelog(LOG_DEBUG, "Begin phase");
 
   conn_list_do_buffer(game.game_connections);
-  ai_data_movemap_init();
+  ai_data_movemap_recalculate();
 
   phase_players_iterate(pplayer) {
     pplayer->phase_done = FALSE;