Summary: Move cost estimates with class considered
Submitted by: cazfi
Submitted on: Mon 25 Feb 2013 11:07:24 AM EET
Priority: 5 - Normal
Status: Ready For Test
Assigned to: None
Discussion Lock: Any
Planned Release: 2.5.0
tile_move_cost_ptrs() can be called without actual unit to get at least some
estimate of the move costs. Both path finding and AI use it that way. The
assumptions it makes when there's NULL unit are that unit can benefit from all
roads, its speed is affected by terrain (path finding tries not to use it when
this assumption would be wrong, but this really success with rulesets closely
resembling default ones only), unit has no IgTerr type flag, move is not
disembarging from a boat when slowinvasion is on.
While the callers have no exact unit to pass to tile_move_cost_ptrs(), they
often have unit class, and many of the things tile_move_cost_ptrs() guesses in
case of NULL unit are actually dependant on unit class only.
Attached patch makes tile_move_cost_ptrs() to take unit class parameter in
addition to actual unit. If you pass both, they must be consistent (i.e.,
class must be that of the unit). Unit class is used to get as accurate results
This still leaves IgTerr part to guesswork as it's unit type flag. We could
pass also unit type in addition to class (cannot pass it instead of class, as
most callers do not have exact type while they have class) or just boolean
telling if unit should be assumed to have IgTerr.
Date: Mon 25 Feb 2013 11:07:24 AM EET Name: ClassMoveCost.patch Size: 7kB
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list