2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file signal_func.h Functions related to signals. */
13 #include "track_type.h"
14 #include "tile_type.h"
15 #include "direction_type.h"
16 #include "company_type.h"
19 * Maps a trackdir to the bit that stores its status in the map arrays, in the
20 * direction along with the trackdir.
22 static inline byte
SignalAlongTrackdir(Trackdir trackdir
)
24 extern const byte _signal_along_trackdir
[TRACKDIR_END
];
25 return _signal_along_trackdir
[trackdir
];
29 * Maps a trackdir to the bit that stores its status in the map arrays, in the
30 * direction against the trackdir.
32 static inline byte
SignalAgainstTrackdir(Trackdir trackdir
)
34 extern const byte _signal_against_trackdir
[TRACKDIR_END
];
35 return _signal_against_trackdir
[trackdir
];
39 * Maps a Track to the bits that store the status of the two signals that can
40 * be present on the given track.
42 static inline byte
SignalOnTrack(Track track
)
44 extern const byte _signal_on_track
[TRACK_END
];
45 return _signal_on_track
[track
];
48 /** State of the signal segment */
50 SIGSEG_FREE
, ///< Free and has no pre-signal exits or at least one green exit
51 SIGSEG_FULL
, ///< Occupied by a train
52 SIGSEG_PBS
, ///< Segment is a PBS segment
55 SigSegState
UpdateSignalsOnSegment(TileIndex tile
, DiagDirection side
, Owner owner
);
56 void SetSignalsOnBothDir(TileIndex tile
, Track track
, Owner owner
);
57 void AddTrackToSignalBuffer(TileIndex tile
, Track track
, Owner owner
);
58 void AddSideToSignalBuffer(TileIndex tile
, DiagDirection side
, Owner owner
);
59 void UpdateSignalsInBuffer();
61 #endif /* SIGNAL_FUNC_H */