From b11852a0762675997d7c75d6d3f38544c9ed7906 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 5 May 2020 00:12:32 +0100 Subject: [PATCH] Fix insufficient YAPF cost added when reversing behind signal Fix 29520437, which was an insufficient fix See: #150 --- src/pathfinder/yapf/yapf_costrail.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp index 5098ca24e5..1549467189 100644 --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -482,8 +482,8 @@ public: int y1 = 2 * TileY(prev.tile); int x2 = 2 * TileX(cur.tile); int y2 = 2 * TileY(cur.tile); - int dx = abs(x1 - x2) + 1; - int dy = abs(y1 - y2) + 1; + int dx = abs(x1 - x2) + 4; // up to 2x track exit dir tile offsets in opposite directions + int dy = abs(y1 - y2) + 4; // " int dmin = min(dx, dy); int dxy = abs(dx - dy); segment_entry_cost += dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2);