mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r2647) Fix: [ntp] Fix assertion error introduced in r2635
This commit is contained in:
parent
b8b14ac6c8
commit
26c8bdde43
22
pathfind.c
22
pathfind.c
@ -695,7 +695,6 @@ callback_and_continue:
|
|||||||
|
|
||||||
assert(si.track <= 13);
|
assert(si.track <= 13);
|
||||||
direction = _tpf_new_direction[si.track];
|
direction = _tpf_new_direction[si.track];
|
||||||
assert(direction <= 3);
|
|
||||||
|
|
||||||
start_at:
|
start_at:
|
||||||
// If the tile is the entry tile of a tunnel, and we're not going out of the tunnel,
|
// If the tile is the entry tile of a tunnel, and we're not going out of the tunnel,
|
||||||
@ -754,19 +753,19 @@ start_at:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Regular rail tile, determine which tracks exist.
|
// Regular rail tile, determine which tracks exist.
|
||||||
bits = _m[tile].m5 & 0x3F;
|
bits = _m[tile].m5 & _bits_mask[direction];
|
||||||
if (bits == 0)
|
|
||||||
break; // None at all?
|
|
||||||
|
|
||||||
// Make sure that the tile contains exactly ONE track
|
// The tile has no reachable tracks, or
|
||||||
if (KILL_FIRST_BIT(bits) != 0) {
|
// does the tile contain more than one track?
|
||||||
// It contained many tracks,
|
if (bits == 0 || KILL_FIRST_BIT(_m[tile].m5 & 0x3F) != 0)
|
||||||
// but first, mask out the tracks that are not reachable
|
|
||||||
bits &= _bits_mask[direction];
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
// If we reach here, the tile has exactly one track, and this
|
||||||
|
// track is reachable.
|
||||||
|
|
||||||
track = _new_track[FIND_FIRST_BIT(bits)][direction];
|
track = _new_track[FIND_FIRST_BIT(bits)][direction];
|
||||||
|
assert(track != 0xff);
|
||||||
|
|
||||||
si.cur_length += _length_of_track[track];
|
si.cur_length += _length_of_track[track];
|
||||||
|
|
||||||
// Check if this rail is an upwards slope. If it is, then add a penalty.
|
// Check if this rail is an upwards slope. If it is, then add a penalty.
|
||||||
@ -818,7 +817,6 @@ start_at:
|
|||||||
|
|
||||||
// continue with the next track
|
// continue with the next track
|
||||||
direction = _tpf_new_direction[track];
|
direction = _tpf_new_direction[track];
|
||||||
assert(direction <= 3);
|
|
||||||
|
|
||||||
// safety check if we're running around chasing our tail... (infinite loop)
|
// safety check if we're running around chasing our tail... (infinite loop)
|
||||||
if (tile == tile_org) {
|
if (tile == tile_org) {
|
||||||
@ -856,9 +854,7 @@ start_at:
|
|||||||
si.depth++;
|
si.depth++;
|
||||||
si.tile = tile;
|
si.tile = tile;
|
||||||
do {
|
do {
|
||||||
assert(direction <= 3);
|
|
||||||
si.track = _new_track[FIND_FIRST_BIT(bits)][direction];
|
si.track = _new_track[FIND_FIRST_BIT(bits)][direction];
|
||||||
assert(si.track <= 13);
|
|
||||||
si.priority = si.cur_length + estimation;
|
si.priority = si.cur_length + estimation;
|
||||||
|
|
||||||
// out of stack items, bail out?
|
// out of stack items, bail out?
|
||||||
|
Loading…
Reference in New Issue
Block a user