URL:
<http://gna.org/patch/?3886>
Summary: Refactoring tile_move_cost_ptrs()
Project: Freeciv
Submitted by: persia
Submitted on: Mon 29 Apr 2013 04:01:31 PM JST
Category: general
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Planned Release:
_______________________________________________________
Details:
I've been looking at pathfinding, and many of my investigations fall back
into tile_move_cost_ptrs(), making me think about ways it might be faster to
execute (as it is called so often).
The attached patch tries to streamline the execution path, avoiding
duplicate conditionals and unnecessary caching, and attempting to delay all
operations as late as possible (especially the road iteration, in the hopes it
need not be performed).
In passing, I addressed the FC_INFINITY TODO, as passing this correctly is
essential for proper pathfinding, although the only situation in which it
wasn't already handled correctly was for fueled units with nativity
restrictions (which aren't present in shipping rulesets). This will introduce
a behaviour change for pathfinding, correctly charging the remainder of the
move when determining a path if slow invasions is enabled (currently
pathfinding assumes units may continue to move in such situations if their
move points are not all used, potentially leading to units standing on the
coast in positions they might otherwise have avoided as final positions (e.g.
next to enemy military units)).
Another introduced behaviour change is that with this logic UTYF_IGTER
units entering non-native terrain that has a road native to the unit without
the RF_NATIVE_TILE flag and with a move cost less than MOVE_COST_IGTER will be
charged MOVE_COST_IGTER move points, rather than the cost from the road.
Again, not something present in any shipping rulesets, and easily worked
around by ruleset authors by adjusting RF_NATIVE_TILE for the road.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Mon 29 Apr 2013 04:01:31 PM JST Name:
refactor-tile_move_cost_ptrs.patch Size: 6kB By: persia
<http://gna.org/patch/download.php?file_id=17851>
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?3886>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev