diff options
author | KUDr <kudr@openttd.org> | 2006-05-27 16:12:16 +0000 |
---|---|---|
committer | KUDr <kudr@openttd.org> | 2006-05-27 16:12:16 +0000 |
commit | 5e73dce0e71791b87e5b096a890578eefcc26639 (patch) | |
tree | e4580db6e03032a997fce1392929b7190dc3b03d /pathfind.c | |
parent | 3d01010440440cfbffd1e5d3b0cf1f23f0503a76 (diff) | |
download | openttd-5e73dce0e71791b87e5b096a890578eefcc26639.tar.xz |
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
Diffstat (limited to 'pathfind.c')
-rw-r--r-- | pathfind.c | 20 |
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); |