Update of patch #6550 (project freeciv):
Status: In Progress => Ready For Test
Planned Release: 2.5.x, 2.6.0, 3.0.0 => 2.5.2, 2.6.0, 3.0.0
_______________________________________________________
Follow-up Comment #2:
Scrap that previous patch, and optimize is_cardinal_move() directly, at least
for the worst case (direction is *not* cardinal, or is the very last cardinal
direction to check)
Old code called get_direction_for_step() and then compared if the direction
returned is cardinal one. Under the hood this expanded to:
- Iterating through all the legal directions
- Comparing if move to that direction would match the move we're checking
- Once matching direction is found, check if it's cardinal one
New code cuts out function call overhead and:
- Iterates through cardinal directions only (not so many directions to check)
- Compares if move to that direction matches the move we're checking -> if it
does, it's cardinal move
- If no matches found -> move is not cardinal. No need for separate check of
direction cardinality
(file #25726)
_______________________________________________________
Additional Item Attachment:
File name: IsMoveCardinalOptimize.patch Size:1 KB
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?6550>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev