mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-24 16:09:30 +00:00
(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.
This commit is contained in:
parent
7f941818a8
commit
4bd95d756e
10
npf.c
10
npf.c
@ -506,7 +506,7 @@ void NPFFollowTrack(AyStar* aystar, OpenListNode* current) {
|
|||||||
exitdir = GetDepotDirection(src_tile, type);
|
exitdir = GetDepotDirection(src_tile, type);
|
||||||
|
|
||||||
/* Let's see if were headed the right way */
|
/* 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
|
/* We are headed inwards. We can only reverse here, so we'll not
|
||||||
* consider this direction, but jump ahead to the reverse direction.
|
* consider this direction, but jump ahead to the reverse direction.
|
||||||
* It would be nicer to return one neighbour here (the reverse
|
* It would be nicer to return one neighbour here (the reverse
|
||||||
@ -540,18 +540,18 @@ void NPFFollowTrack(AyStar* aystar, OpenListNode* current) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Determine available tracks */
|
/* Determine available tracks */
|
||||||
if (type == TRANSPORT_ROAD && (IsRoadStationTile(dst_tile) || IsTileDepotType(dst_tile, TRANSPORT_ROAD))){
|
if (type != TRANSPORT_WATER && (IsRoadStationTile(dst_tile) || IsTileDepotType(dst_tile, type))){
|
||||||
/* Road stations and depots return 0 on GTTS, so we have to do this by hand... */
|
/* Road stations and road and train depots return 0 on GTTS, so we have to do this by hand... */
|
||||||
byte exitdir;
|
byte exitdir;
|
||||||
if (IsRoadStationTile(dst_tile))
|
if (IsRoadStationTile(dst_tile))
|
||||||
exitdir = GetRoadStationDir(dst_tile);
|
exitdir = GetRoadStationDir(dst_tile);
|
||||||
else /* Road depot */
|
else /* Road or train depot */
|
||||||
exitdir = GetDepotDirection(dst_tile, type);
|
exitdir = GetDepotDirection(dst_tile, type);
|
||||||
/* Find the trackdirs that are available for a depot or station with this
|
/* Find the trackdirs that are available for a depot or station with this
|
||||||
* orientation. They are only "inwards", since we are reaching this tile
|
* orientation. They are only "inwards", since we are reaching this tile
|
||||||
* from some other tile. This prevents vehicles driving into depots from
|
* from some other tile. This prevents vehicles driving into depots from
|
||||||
* the back */
|
* the back */
|
||||||
ts = (1 << _dir_to_diag_trackdir[exitdir]);
|
ts = (1 << _dir_to_diag_trackdir[_reverse_dir[exitdir]]);
|
||||||
} else {
|
} else {
|
||||||
ts = GetTileTrackStatus(dst_tile, type);
|
ts = GetTileTrackStatus(dst_tile, type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user