(svn r6495) -Codechange: removed direct map access in pathfind.c

This commit is contained in:
glx 2006-09-22 21:52:31 +00:00
parent b51a42438b
commit 4921538e1d

View File

@ -802,21 +802,18 @@ start_at:
// railway tile with signals..? // railway tile with signals..?
if (HasSignals(tile)) { if (HasSignals(tile)) {
byte m3; if (!HasSignalOnTrackdir(tile, track)) {
m3 = _m[tile].m3;
if (!(m3 & SignalAlongTrackdir(track))) {
// if one way signal not pointing towards us, stop going in this direction => End of rail segment. // if one way signal not pointing towards us, stop going in this direction => End of rail segment.
if (m3 & SignalAgainstTrackdir(track)) { if (HasSignalOnTrackdir(tile, ReverseTrackdir(track))) {
bits = 0; bits = 0;
break; break;
} }
} else if (_m[tile].m2 & SignalAlongTrackdir(track)) { } else if (GetSignalStateByTrackdir(tile, track) == SIGNAL_STATE_GREEN) {
// green signal in our direction. either one way or two way. // green signal in our direction. either one way or two way.
si.state |= 3; si.state |= 3;
} else { } else {
// reached a red signal. // reached a red signal.
if (m3 & SignalAgainstTrackdir(track)) { if (HasSignalOnTrackdir(tile, ReverseTrackdir(track))) {
// two way red signal. unless we passed another green signal on the way, // two way red signal. unless we passed another green signal on the way,
// stop going in this direction => End of rail segment. // stop going in this direction => End of rail segment.
// this is to prevent us from going into a full platform. // this is to prevent us from going into a full platform.