Fix insufficient YAPF cost added when reversing behind signal

Distance to target cost compensation was too small in case where target
was perfectly in line with reversing track due to exit direction offset
added in PfCalcEstimate.

See: #147
This commit is contained in:
Jonathan G Rennison
2020-04-25 11:46:18 +01:00
parent eef6ad7b2a
commit 2952043748

View File

@@ -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);
int dy = abs(y1 - y2);
int dx = abs(x1 - x2) + 1;
int dy = abs(y1 - y2) + 1;
int dmin = min(dx, dy);
int dxy = abs(dx - dy);
segment_entry_cost += dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2);