From f44a9a5d5b468496fe92473e3bbd6a556efabf12 Mon Sep 17 00:00:00 2001 From: smatz Date: Wed, 9 Jan 2008 23:00:59 +0000 Subject: (svn r11802) -Fix [FS#716]: do not crash trains when leaving depot to a very long track -Codechange: use dedicated pathfinder for signal updating, resulting in better performance and possible future improvements --- src/rail_map.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/rail_map.h') diff --git a/src/rail_map.h b/src/rail_map.h index 9b9bc16ef..d4f63c72b 100644 --- a/src/rail_map.h +++ b/src/rail_map.h @@ -375,6 +375,18 @@ static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trac SIGNAL_STATE_GREEN : SIGNAL_STATE_RED; } +/** + * Sets the state of the signal along the given trackdir. + */ +static inline void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, SignalState state) +{ + if (state == SIGNAL_STATE_GREEN) { // set 1 + SetSignalStates(tile, GetSignalStates(tile) | SignalAlongTrackdir(trackdir)); + } else { + SetSignalStates(tile, GetSignalStates(tile) & ~SignalAlongTrackdir(trackdir)); + } +} + /** * Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile. -- cgit v1.2.3-54-g00ecf