|
@@ -122,24 +122,25 @@ static const byte _otherdir_mask[4] = {
|
|
|
#ifdef DEBUG_TILE_PUSH
|
|
|
extern void dbg_push_tile(TileIndex tile, int track);
|
|
|
extern void dbg_pop_tile();
|
|
|
#endif
|
|
|
|
|
|
static void TPFMode2(TrackPathFinder *tpf, TileIndex tile, int direction)
|
|
|
{
|
|
|
uint bits;
|
|
|
int i;
|
|
|
RememberData rd;
|
|
|
int owner = -1;
|
|
|
|
|
|
/* XXX: Mode 2 is currently only used for ships, why is this code here? */
|
|
|
if (tpf->tracktype == TRANSPORT_RAIL) {
|
|
|
if (IsTileType(tile, MP_RAILWAY) || IsTileType(tile, MP_STATION) || IsTileType(tile, MP_TUNNELBRIDGE)) {
|
|
|
owner = GetTileOwner(tile);
|
|
|
/* Check if we are on the middle of a bridge (has no owner) */
|
|
|
if (IsTileType(tile, MP_TUNNELBRIDGE) && (_map5[tile] & 0xC0) == 0xC0)
|
|
|
owner = -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// This addition will sometimes overflow by a single tile.
|
|
|
// 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.
|
|
@@ -331,24 +332,28 @@ static void TPFMode1(TrackPathFinder *tp
|
|
|
dbg_pop_tile();
|
|
|
#endif
|
|
|
tpf->rd = rd;
|
|
|
} while (bits != 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* the next is only used when signals are checked.
|
|
|
* seems to go in 2 directions simultaneously */
|
|
|
|
|
|
/* if i can get rid of this, tail end recursion can be used to minimize
|
|
|
* stack space dramatically. */
|
|
|
|
|
|
/* If we are doing signal setting, we must reverse at evere tile, so we
|
|
|
* iterate all the tracks in a signal block, even when a normal train would
|
|
|
* not reach it (for example, when two lines merge */
|
|
|
if (tpf->hasbit_13)
|
|
|
return;
|
|
|
|
|
|
tile = tile_org;
|
|
|
direction ^= 2;
|
|
|
|
|
|
bits = GetTileTrackStatus(tile, tpf->tracktype);
|
|
|
bits |= (bits >> 8);
|
|
|
|
|
|
if ( (byte)bits != tpf->var2) {
|
|
|
bits &= _bits_mask[direction];
|
|
|
}
|