summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-08-31 09:57:44 +0200
committerGitHub <noreply@github.com>2021-08-31 09:57:44 +0200
commitf87fe395a7d197a9feb080cccaa2889c870935f6 (patch)
treea2db56bbec2d271eee0b88018b6c33c0394befe3
parent219598a90b4b71b9e80e9986f954dd1e19a251b2 (diff)
downloadopenttd-f87fe395a7d197a9feb080cccaa2889c870935f6.tar.xz
Fix: pathfinders always tried to avoid docking tiles (even if nothing was on them) (#9522)
When coming across any docking tile (for example, all tiles around an oilrig are docking tiles), it always at least added a penalty of 3 times a normal tile, even when there are no ships on them. In result, the pathfinder got suggested to always go around docking tiles. This was most likely not the intention of the change made in 31db4f8d5e.
-rw-r--r--src/pathfinder/npf/npf.cpp2
-rw-r--r--src/pathfinder/yapf/yapf_ship.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp
index 24803fb31..3bc596e63 100644
--- a/src/pathfinder/npf/npf.cpp
+++ b/src/pathfinder/npf/npf.cpp
@@ -330,7 +330,7 @@ static int32 NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *par
if (IsDockingTile(current->tile)) {
/* Check docking tile for occupancy */
- uint count = 1;
+ uint count = 0;
HasVehicleOnPos(current->tile, &count, &CountShipProc);
cost += count * 3 * _trackdir_length[trackdir];
}
diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp
index ec4348e83..d47afe5df 100644
--- a/src/pathfinder/yapf/yapf_ship.cpp
+++ b/src/pathfinder/yapf/yapf_ship.cpp
@@ -287,7 +287,7 @@ public:
if (IsDockingTile(n.GetTile())) {
/* Check docking tile for occupancy */
- uint count = 1;
+ uint count = 0;
HasVehicleOnPos(n.GetTile(), &count, &CountShipProc);
c += count * 3 * YAPF_TILE_LENGTH;
}