Author: cazfi
Date: Tue Aug 16 11:33:34 2016
New Revision: 33617

URL: http://svn.gna.org/viewcvs/freeciv?rev=33617&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:
    branches/S2_6/common/aicore/pf_tools.c

Modified: branches/S2_6/common/aicore/pf_tools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/aicore/pf_tools.c?rev=33617&r1=33616&r2=33617&view=diff
==============================================================================
--- branches/S2_6/common/aicore/pf_tools.c      (original)
+++ branches/S2_6/common/aicore/pf_tools.c      Tue Aug 16 11:33:34 2016
@@ -843,6 +843,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;
+  }
 }
 
 /**********************************************************************
@@ -893,7 +898,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;
+  }
 }
 
 /**********************************************************************
@@ -979,7 +988,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