Summary: Consolidate UTYF_IGTER logic
                 Project: Freeciv
            Submitted by: persia
            Submitted on: Wed 08 May 2013 04:18:26 PM JST
                Category: ai
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 



    UTYF_IGTER movement for pathfinding is handled in three different ways in
three different places, and entirely ignored in other places.  Precisely which
sorts of movement receive IgTer benefits, which sorts have costs independent
of IgTer, and which may benefit from IgTer depending on other conditions is
somewhat complex, and so best handled in a single place with a single function
to ensure consistency.

    This patch does just that, moving all movement-cost related handling of
UTYF_IGTER to tile_move_cost_ptrs().  Other uses (e.g. establishing relative
desire for a unit based on the IgTer flag in the AI) are unchanged.  Behaviour
changes are all attributable to differences in pathfinding results: prior
handling sometimes assigned MOVE_COST_IGTER in cases where SINGLE_MOVE would
have been charged for actual unit attack/movement, sometimes the precise
opposite, and often entirely ignored the possibility of differences between
UTYF_IGTER units and other units (e.g. ferry passerger handling, attack
planning, etc.).

    Any remaining issues with incorrect pathfinding move costs for UTYF_IGTER
units are likely to either represent intended behaviour changes (and be
confined to tile_move_cost_ptrs()), or indicate more general problems with
move cost calculation in the relevant get_MC callbacks.  Nothing should change
for callers of map_move_cost_unit() other than the ordering of calls (the
presence of the flag is checked a bit earlier in the execution path).

    The patch attached depends on patch #3886, patch #3837, and patch #3897 ,
but mostly for syntactical reasons.  #3886 introduces the "igter" boolean to
tile_move_cost_ptrs(): without this the current patch would need to use the
argument rather than checking the unit flag in the relevant conditional. 
#3837 changes the logic for some unit class and unit type flags without which
this patch cannot delete the removed functions.  #3897 introduces
slow_invasions handling for igter_move_unit(), which is identified for
deletion.  If this is considered more useful than any of those, I would be
happy to change the dependency order.


File Attachments:

Date: Wed 08 May 2013 04:18:26 PM JST  Name:
consolidate-UTYF_IGTER-logic.patch  Size: 10kB   By: persia



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to