Summary: Pathfinding for fueled units can waste time looking
too far for refuel point?
Submitted by: jtn
Submitted on: Tue Dec 24 00:13:34 2013
Severity: 2 - Minor
Priority: 5 - Normal
Assigned to: None
Discussion Lock: Any
Operating System: Any
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
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list