patchFreeciv - Patches: patch #4889, Pathfinding refactoring

Show feedback again

patch #4889: Pathfinding refactoring

Submitted by:  pepeto <pepeto>
Submitted on:  Wed Jul 2 13:24:47 2014  
Category: aiPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: pepeto <pepeto>Open/Closed: Closed
Planned Release: 2.6.0Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Wed Jul 9 12:58:35 2014, SVN revision 25467:

Pathfinding refactoring. Main changes are that "can_invade" is now hard-coded,
more calculated values are cached, action handling (for attack, diplomat
actions and trade route establishing) is now open for more control.

See gna patch #4889

(Browse SVN revision 25467)

pepeto <pepeto>
Project MemberIn charge of this item.
Sun Jul 6 11:39:01 2014, comment #2:

New version:

  • clarify the usage of paranthesizes in pf_get_action() ;
  • split 'enum pf_action' and 'enum pf_action_account' ;
  • fixed node behavior overwrite ;
  • added some comments.

(file #21297)

pepeto <pepeto>
Project MemberIn charge of this item.
Thu Jul 3 00:10:55 2014, comment #1:

In pf_get_action(), could parentheses be added to the assignment of non_allied_city_tile? I found it surprising to read (also, when assigning as the first call in a function, I prefer assigning in declaration, but not doing that isn't unclear).

Emmet Hikory <persia>
Project Member
Wed Jul 2 13:24:47 2014, original submission:
  • can_invade() is now hard-coded ;
  • better handling of cached values when the tile is not known (notably at server side without omniscience) ;
  • better action handling, including attacks, diplomat actions and trade route establishing ;
  • cache values previously calculated in pf_is_ok_move_tile() ;
  • handle correctly the case we would want to ignore start tile (then the former behavior is restored) ;
  • handle correctly the case the unit is transported initially and would not return to transported (if it has orders) if returning at start tile.

It speeds up the algorithm considerably. Amphibious moves are not perfectly handled, but it wasn't the case before (not a regression).

pepeto <pepeto>
Project MemberIn charge of this item.


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #21297:  pf_refactoring2.patch.gz added by pepeto (11kB - application/gzip)
file #21239:  pf_refactoring.patch.gz added by pepeto (11kB - application/gzip)


Depends on the following items: None found

   patch dependencies.


Carbon-Copy List
  • -unavailable- added by persia (Posted a comment)
  • -unavailable- added by pepeto (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Jul 9 12:58:49 2014pepetoStatusReady For Test=>Done
    Sun Jul 6 18:32:58 2014pepetoDependencies-=>patch #4910 is dependent
    Sun Jul 6 11:39:01 2014pepetoAttached File-=>Added pf_refactoring2.patch.gz, #21297
      StatusIn Progress=>Ready For Test
    Sun Jul 6 09:39:43 2014pepetoStatusReady For Test=>In Progress
    Wed Jul 2 13:24:47 2014pepetoAttached File-=>Added pf_refactoring.patch.gz, #21239
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup