Author: cazfi
Date: Tue Aug 16 11:33:27 2016
New Revision: 33616

URL: http://svn.gna.org/viewcvs/freeciv?rev=33616&view=rev
Log:
Always use fuel map in pathfinding when unit type uses fuel.

This avoids related assertion failures and crashes, but does not teach AI
not to lose units to out-of-fuel when it assumes that unit of that kind should 
have no fuel

See bug #24820

Modified:
    trunk/common/aicore/pf_tools.c

Modified: trunk/common/aicore/pf_tools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/aicore/pf_tools.c?rev=33616&r1=33615&r2=33616&view=diff
==============================================================================
--- trunk/common/aicore/pf_tools.c      (original)
+++ trunk/common/aicore/pf_tools.c      Tue Aug 16 11:33:27 2016
@@ -849,6 +849,11 @@
   } else {
     parameter->get_zoc = NULL;
   }
+
+  if (!parameter->get_moves_left_req && utype_fuel(punittype)) {
+    /* Unit needs fuel */
+    parameter->get_moves_left_req = get_fuel_moves_left_req;
+  }
 }
 
 /**********************************************************************
@@ -899,7 +904,11 @@
 
   /* It is too complicated to work with danger here */
   parameter->is_pos_dangerous = NULL;
-  parameter->get_moves_left_req = NULL;
+
+  if (!parameter->get_moves_left_req && utype_fuel(punittype)) {
+    /* Unit needs fuel */
+    parameter->get_moves_left_req = get_fuel_moves_left_req;
+  }
 }
 
 /**********************************************************************
@@ -985,7 +994,13 @@
   } else {
     parameter->combined.is_pos_dangerous = NULL;
   }
-  parameter->combined.get_moves_left_req = NULL;
+  if (parameter->sea.get_moves_left_req != NULL) {
+    parameter->combined.get_moves_left_req = parameter->sea.get_moves_left_req;
+  } else if (parameter->land.get_moves_left_req != NULL) {
+    parameter->combined.get_moves_left_req = 
parameter->land.get_moves_left_req;
+  } else {
+    parameter->combined.get_moves_left_req = NULL;
+  }
   parameter->combined.get_action = NULL;
   parameter->combined.is_action_possible = NULL;
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to