summaryrefslogtreecommitdiff
path: root/pathfind.c
diff options
context:
space:
mode:
Diffstat (limited to 'pathfind.c')
-rw-r--r--pathfind.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/pathfind.c b/pathfind.c
index eff90d60a..622b820f0 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -3,6 +3,8 @@
#include "stdafx.h"
#include "openttd.h"
#include "bridge_map.h"
+#include "station_map.h"
+#include "depot.h"
#include "functions.h"
#include "map.h"
#include "tile.h"
@@ -254,6 +256,15 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
RememberData rd;
TileIndex tile_org = tile;
+ // check if the old tile can be left at that direction
+ if (tpf->tracktype == TRANSPORT_ROAD) {
+ // road stops and depots now have a track (r4419)
+ // don't enter road stop from the back
+ if (IsRoadStopTile(tile) && GetRoadStopDir(tile) != direction) return;
+ // don't enter road depot from the back
+ if (IsTileDepotType(tile, TRANSPORT_ROAD) && GetRoadDepotDirection(tile) != direction) return;
+ }
+
if (IsTunnelTile(tile)) {
if (GetTunnelDirection(tile) != direction ||
GetTunnelTransportType(tile) != tpf->tracktype) {
@@ -277,6 +288,15 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
return;
}
+ // check if the new tile can be entered from that direction
+ if (tpf->tracktype == TRANSPORT_ROAD) {
+ // road stops and depots now have a track (r4419)
+ // don't enter road stop from the back
+ if (IsRoadStopTile(tile) && GetRoadStopDir(tile) == direction) return;
+ // don't enter road depot from the back
+ if (IsTileDepotType(tile, TRANSPORT_ROAD) && GetRoadDepotDirection(tile) == direction) return;
+ }
+
tpf->rd.cur_length++;
bits = GetTileTrackStatus(tile, tpf->tracktype);