mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-07 06:39:08 +00:00
(svn r1203) -Fix: the pathfinder no longer sees rail with an other owner as a
possible route. This also makes sure signals don't show red because there is a train on the track of an other owner.
This commit is contained in:
parent
07d0fd6719
commit
8ab0190c29
12
pathfind.c
12
pathfind.c
@ -128,12 +128,19 @@ static void TPFMode2(TrackPathFinder *tpf, uint tile, int direction)
|
|||||||
uint bits;
|
uint bits;
|
||||||
int i;
|
int i;
|
||||||
RememberData rd;
|
RememberData rd;
|
||||||
|
byte owner;
|
||||||
|
|
||||||
|
owner = _map_owner[tile];
|
||||||
|
|
||||||
// This addition will sometimes overflow by a single tile.
|
// This addition will sometimes overflow by a single tile.
|
||||||
// The use of TILE_MASK here makes sure that we still point at a valid
|
// The use of TILE_MASK here makes sure that we still point at a valid
|
||||||
// tile, and then this tile will be in the sentinel row/col, so GetTileTrackStatus will fail.
|
// tile, and then this tile will be in the sentinel row/col, so GetTileTrackStatus will fail.
|
||||||
tile = TILE_MASK(tile + _tileoffs_by_dir[direction]);
|
tile = TILE_MASK(tile + _tileoffs_by_dir[direction]);
|
||||||
|
|
||||||
|
/* Check in case of rail if the owner is the same */
|
||||||
|
if (tpf->tracktype == TRANSPORT_RAIL && _map_owner[tile] != owner)
|
||||||
|
return;
|
||||||
|
|
||||||
if (++tpf->rd.cur_length > 50)
|
if (++tpf->rd.cur_length > 50)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -268,6 +275,11 @@ static void TPFMode1(TrackPathFinder *tpf, uint tile, int direction)
|
|||||||
tile = SkipToEndOfTunnel(tpf, tile, direction);
|
tile = SkipToEndOfTunnel(tpf, tile, direction);
|
||||||
}
|
}
|
||||||
tile += _tileoffs_by_dir[direction];
|
tile += _tileoffs_by_dir[direction];
|
||||||
|
|
||||||
|
/* Check in case of rail if the owner is the same */
|
||||||
|
if (tpf->tracktype == TRANSPORT_RAIL && _map_owner[tile_org] != _map_owner[tile])
|
||||||
|
return;
|
||||||
|
|
||||||
tpf->rd.cur_length++;
|
tpf->rd.cur_length++;
|
||||||
|
|
||||||
bits = GetTileTrackStatus(tile, tpf->tracktype);
|
bits = GetTileTrackStatus(tile, tpf->tracktype);
|
||||||
|
Loading…
Reference in New Issue
Block a user