summaryrefslogtreecommitdiff
path: root/npf.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-04-06 21:03:24 +0000
committermatthijs <matthijs@openttd.org>2005-04-06 21:03:24 +0000
commit4bd95d756e86b978e8f6ac9e246f820d28133bb9 (patch)
treee03cfa49107f494d187823d8b1ba2b23f75e27ba /npf.c
parent7f941818a8797087eac4ac5c0d0300762132c7a5 (diff)
downloadopenttd-4bd95d756e86b978e8f6ac9e246f820d28133bb9.tar.xz
(svn r2159) - Fix: [NPF] Road vehicles never found their target station or depots (introduced in r2154)
- Fix: [NPF] Trains still tried to go through the back of depots.
Diffstat (limited to 'npf.c')
-rw-r--r--npf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/npf.c b/npf.c
index c6a98f4c5..15f11dfcb 100644
--- a/npf.c
+++ b/npf.c
@@ -506,7 +506,7 @@ void NPFFollowTrack(AyStar* aystar, OpenListNode* current) {
exitdir = GetDepotDirection(src_tile, type);
/* Let's see if were headed the right way */
- if (src_trackdir != _dir_to_diag_trackdir[exitdir])
+ if (src_trackdir == _dir_to_diag_trackdir[_reverse_dir[exitdir]])
/* We are headed inwards. We can only reverse here, so we'll not
* consider this direction, but jump ahead to the reverse direction.
* It would be nicer to return one neighbour here (the reverse
@@ -540,18 +540,18 @@ void NPFFollowTrack(AyStar* aystar, OpenListNode* current) {
return;
/* Determine available tracks */
- if (type == TRANSPORT_ROAD && (IsRoadStationTile(dst_tile) || IsTileDepotType(dst_tile, TRANSPORT_ROAD))){
- /* Road stations and depots return 0 on GTTS, so we have to do this by hand... */
+ if (type != TRANSPORT_WATER && (IsRoadStationTile(dst_tile) || IsTileDepotType(dst_tile, type))){
+ /* Road stations and road and train depots return 0 on GTTS, so we have to do this by hand... */
byte exitdir;
if (IsRoadStationTile(dst_tile))
exitdir = GetRoadStationDir(dst_tile);
- else /* Road depot */
+ else /* Road or train depot */
exitdir = GetDepotDirection(dst_tile, type);
/* Find the trackdirs that are available for a depot or station with this
* orientation. They are only "inwards", since we are reaching this tile
* from some other tile. This prevents vehicles driving into depots from
* the back */
- ts = (1 << _dir_to_diag_trackdir[exitdir]);
+ ts = (1 << _dir_to_diag_trackdir[_reverse_dir[exitdir]]);
} else {
ts = GetTileTrackStatus(dst_tile, type);
}