Re: [Freeciv-Dev] (PR#39941) gravship goto crashes

2007-12-02 Thread William Allen Simpson

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

Jason Dorje Short wrote:
 Gravships (air units with 0 - unlimited - fuel) crash when goto is invoked.
 
This has been reported in the past, but since there are no air units with
zero fuel in the officially supported rulesets, it has not been a priority.


 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 
 gravships.
 
Please, no more quick fixes.  Find all the issues, describe the range of
solutions, and we'll discuss it here



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39941) gravship goto crashes

2007-12-02 Thread Daniel Markstedt

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

On Dec 2, 2007 10:37 PM, William Allen Simpson
[EMAIL PROTECTED] wrote:

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

 Jason Dorje Short wrote:
  Gravships (air units with 0 - unlimited - fuel) crash when goto is invoked.
 
 This has been reported in the past, but since there are no air units with
 zero fuel in the officially supported rulesets, it has not been a priority.


I'd just like to add that this has been reported by a forum user for
his 'galactic ruleset' project, so the crash has been seen 'in the
wild':

http://forum.freeciv.org/viewtopic.php?t=4196

 ~Daniel



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39941) gravship goto crashes

2007-12-02 Thread Jason Dorje Short

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

William Allen Simpson wrote:

 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 
 gravships.

 Please, no more quick fixes.  Find all the issues, describe the range of
 solutions, and we'll discuss it here

As I said, the problem is that fuel=0 is special-cased for air units. 
Similarly non-air-units, which normally have fuel=0 also, get the fuel 
set to 1 to make this special-casing work.

The full fix then would be to leave fuel at 0 for non-air units.  The 
special case, then, would not be on fuel=0 but rather on fuel0.

-jason



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39941) gravship goto crashes

2007-12-01 Thread Jason Dorje Short

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 
gravships.

-jason

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
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev