equal
deleted
inserted
replaced
126 static void TPFMode2(TrackPathFinder *tpf, uint tile, int direction) |
126 static void TPFMode2(TrackPathFinder *tpf, uint tile, int direction) |
127 { |
127 { |
128 uint bits; |
128 uint bits; |
129 int i; |
129 int i; |
130 RememberData rd; |
130 RememberData rd; |
|
131 byte owner; |
|
132 |
|
133 owner = _map_owner[tile]; |
131 |
134 |
132 // This addition will sometimes overflow by a single tile. |
135 // This addition will sometimes overflow by a single tile. |
133 // The use of TILE_MASK here makes sure that we still point at a valid |
136 // The use of TILE_MASK here makes sure that we still point at a valid |
134 // tile, and then this tile will be in the sentinel row/col, so GetTileTrackStatus will fail. |
137 // tile, and then this tile will be in the sentinel row/col, so GetTileTrackStatus will fail. |
135 tile = TILE_MASK(tile + _tileoffs_by_dir[direction]); |
138 tile = TILE_MASK(tile + _tileoffs_by_dir[direction]); |
|
139 |
|
140 /* Check in case of rail if the owner is the same */ |
|
141 if (tpf->tracktype == TRANSPORT_RAIL && _map_owner[tile] != owner) |
|
142 return; |
136 |
143 |
137 if (++tpf->rd.cur_length > 50) |
144 if (++tpf->rd.cur_length > 50) |
138 return; |
145 return; |
139 |
146 |
140 bits = GetTileTrackStatus(tile, tpf->tracktype); |
147 bits = GetTileTrackStatus(tile, tpf->tracktype); |
266 if ((_map5[tile] & 3) != direction || ((_map5[tile]>>2)&3) != tpf->tracktype) |
273 if ((_map5[tile] & 3) != direction || ((_map5[tile]>>2)&3) != tpf->tracktype) |
267 return; |
274 return; |
268 tile = SkipToEndOfTunnel(tpf, tile, direction); |
275 tile = SkipToEndOfTunnel(tpf, tile, direction); |
269 } |
276 } |
270 tile += _tileoffs_by_dir[direction]; |
277 tile += _tileoffs_by_dir[direction]; |
|
278 |
|
279 /* Check in case of rail if the owner is the same */ |
|
280 if (tpf->tracktype == TRANSPORT_RAIL && _map_owner[tile_org] != _map_owner[tile]) |
|
281 return; |
|
282 |
271 tpf->rd.cur_length++; |
283 tpf->rd.cur_length++; |
272 |
284 |
273 bits = GetTileTrackStatus(tile, tpf->tracktype); |
285 bits = GetTileTrackStatus(tile, tpf->tracktype); |
274 |
286 |
275 if ((byte)bits != tpf->var2) { |
287 if ((byte)bits != tpf->var2) { |