URL:
<http://gna.org/bugs/?21369>
Summary: Pathfinding for fueled units can waste time looking
too far for refuel point?
Project: Freeciv
Submitted by: jtn
Submitted on: Tue Dec 24 00:13:34 2013
Category: None
Severity: 2 - Minor
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Release:
Discussion Lock: Any
Operating System: Any
Planned Release:
_______________________________________________________
Details:
While looking into bug #21359, the following lines in
get_fuel_moves_left_req() perplexed me:
mli = param->moves_left_initially;
max = MAX(mli + ((mli - 1) * param->move_rate),
param->move_rate * param->fuel);
/* Sometimes, unit can have bigger moves left than its own move rate,
* due to wonder transfer. See comment for get_turn() in path_finding.c.
*/
Specifically, what quantity is mli+((mli-1)*param->move_rate) (which is likely
to be about the square of the move rate) meant to represent?
I think it should be mli+((param->fuel_left_initially)*param->move_rate) --
i.e. the same calculation as pf_moves_left_initially() does.
However, I _think_ that this is harmless -- 'max' I think only needs to be an
upper bound on the distance it's worth searching for a refuel point, so at
worst this will cause pathfinding to waste time for a fueled unit far from a
refuel point -- this is likely to be rare.
(For a Fighter, it could look up to 300 tiles rather than 10 as it should, I
think, if SINGLE_MOVE=3.)
It would be nice if someone more familiar with pathfinding could check my
reasoning, though.
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?21369>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev