<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39941 >

Gravships (air units with 0 - unlimited - fuel) crash when goto is invoked.

This appears to be caused by the special-casing of the 0 fuel which is 
not special-cased everywhere.  This causes PF to think that the unit 
actually has 0 moves.

Attached is a quick fix but there are other (seemingly non-fatal) bugs 
with this.  For instance it always shows the turns-to-target as 0 for 


Index: common/aicore/path_finding.c
--- common/aicore/path_finding.c	(revision 14109)
+++ common/aicore/path_finding.c	(working copy)
@@ -134,10 +134,12 @@
   with fuel > 1 all moves on the same tank of fuel are considered to be one
   turn.  Thus the rest of the PF code doesn't actually know that the unit
   has fuel, it just thinks it has that many more MP.
+  Units with fuel zero ignore the fuel and just return the move_rate.
 static int get_move_rate(const struct pf_parameter *param)
-  return param->move_rate * param->fuel;
+  return param->move_rate * MAX(param->fuel, 1);
Freeciv-dev mailing list

Reply via email to