URL:
  <http://gna.org/patch/?3747>

                 Summary: Move cost estimates with class considered
                 Project: Freeciv
            Submitted by: cazfi
            Submitted on: Mon 25 Feb 2013 11:07:24 AM EET
                Category: general
                Priority: 5 - Normal
                  Status: Ready For Test
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 2.5.0

    _______________________________________________________

Details:

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
as possible.

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.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 25 Feb 2013 11:07:24 AM EET  Name: ClassMoveCost.patch  Size: 7kB  
By: cazfi

<http://gna.org/patch/download.php?file_id=17335>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?3747>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


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

Reply via email to