Loading

Paste #prutesjvi

  1. diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp
  2. index fb98332..9f3d560 100644
  3. --- a/src/pathfinder/npf/npf.cpp
  4. +++ b/src/pathfinder/npf/npf.cpp
  5. @@ -961,7 +961,7 @@ static void NPFFollowTrack(AyStar *aystar, OpenListNode *current)
  6.   * multiple targets that are spread around, we should perform a breadth first
  7.   * search by specifiying CalcZero as our heuristic.
  8.   */
  9. -static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start_tile1, AyStarNode *start2, bool ignore_start_tile2, NPFFindStationOrTileData *target, AyStar_EndNodeCheck target_proc, AyStar_CalculateH heuristic_proc, AyStarUserData *user, uint reverse_penalty)
  10. +static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start_tile1, AyStarNode *start2, bool ignore_start_tile2, NPFFindStationOrTileData *target, AyStar_EndNodeCheck target_proc, AyStar_CalculateH heuristic_proc, AyStarUserData *user, uint reverse_penalty, bool ignore_reserved = false)
  11.  {
  12.         int r;
  13.         NPFFoundTargetData result;
  14. @@ -982,6 +982,7 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start
  15.         start1->user_data[NPF_TRACKDIR_CHOICE] = INVALID_TRACKDIR;
  16.         start1->user_data[NPF_NODE_FLAGS] = 0;
  17.         NPFSetFlag(start1, NPF_FLAG_IGNORE_START_TILE, ignore_start_tile1);
  18. +       NPFSetFlag(start1, NPF_FLAG_IGNORE_RESERVED, ignore_reserved);
  19.         _npf_aystar.AddStartNode(start1, 0);
  20.         if (start2 != NULL) {
  21.                 start2->user_data[NPF_TRACKDIR_CHOICE] = INVALID_TRACKDIR;
  22. @@ -1226,14 +1227,6 @@ bool NPFTrainFindNearestSafeTile(const Train *v, TileIndex tile, Trackdir trackd
  23.         AyStarNode start1;
  24.         start1.tile = tile;
  25.         start1.direction = trackdir;
  26. -       /* FIXME: NPFRouteInternal is wiping out any flags on startup, also the
  27. -        * NPF_FLAG_IGNORE_RESERVED flag that was intended to be set on this line.
  28. -        * The flag was never set properly, since introdued in r13948. Now the line
  29. -        * is commented out to silence compiler warnings (using uninitialized 'flags').
  30. -        * Currently the NPF_FLAG_IGNORE_RESERVED is nowhere used. It has to be
  31. -        * decided what to do with this flag.
  32. -        *
  33. -        * NPFSetFlag(&start1, NPF_FLAG_IGNORE_RESERVED, true); */
  34.  
  35.         RailTypes railtypes = v->compatible_railtypes;
  36.         if (override_railtype) railtypes |= GetRailTypeInfo(v->railtype)->compatible_railtypes;
  37. @@ -1241,7 +1234,7 @@ bool NPFTrainFindNearestSafeTile(const Train *v, TileIndex tile, Trackdir trackd
  38.         /* perform a breadth first search. Target is NULL,
  39.          * since we are just looking for any safe tile...*/
  40.         AyStarUserData user = { v->owner, TRANSPORT_RAIL, railtypes, ROADTYPES_NONE };
  41. -       return NPFRouteInternal(&start1, true, NULL, false, &fstd, NPFFindSafeTile, NPFCalcZero, &user, 0).res_okay;
  42. +       return NPFRouteInternal(&start1, true, NULL, false, &fstd, NPFFindSafeTile, NPFCalcZero, &user, 0, true).res_okay;
  43.  }
  44.  
  45.  bool NPFTrainCheckReverse(const Train *v)

Comments