Add: Draw network password indicator lock in company drop down list. (#7079)
[openttd-github.git] / src / signal_func.h
blob4597a039b092654e2a8bff2dc2e293c72b5dd0b7
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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 */
10 /** @file signal_func.h Functions related to signals. */
12 #ifndef SIGNAL_FUNC_H
13 #define SIGNAL_FUNC_H
15 #include "track_type.h"
16 #include "tile_type.h"
17 #include "direction_type.h"
18 #include "company_type.h"
20 /**
21 * Maps a trackdir to the bit that stores its status in the map arrays, in the
22 * direction along with the trackdir.
24 static inline byte SignalAlongTrackdir(Trackdir trackdir)
26 extern const byte _signal_along_trackdir[TRACKDIR_END];
27 return _signal_along_trackdir[trackdir];
30 /**
31 * Maps a trackdir to the bit that stores its status in the map arrays, in the
32 * direction against the trackdir.
34 static inline byte SignalAgainstTrackdir(Trackdir trackdir)
36 extern const byte _signal_against_trackdir[TRACKDIR_END];
37 return _signal_against_trackdir[trackdir];
40 /**
41 * Maps a Track to the bits that store the status of the two signals that can
42 * be present on the given track.
44 static inline byte SignalOnTrack(Track track)
46 extern const byte _signal_on_track[TRACK_END];
47 return _signal_on_track[track];
50 /** State of the signal segment */
51 enum SigSegState {
52 SIGSEG_FREE, ///< Free and has no pre-signal exits or at least one green exit
53 SIGSEG_FULL, ///< Occupied by a train
54 SIGSEG_PBS, ///< Segment is a PBS segment
57 SigSegState UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner);
58 void SetSignalsOnBothDir(TileIndex tile, Track track, Owner owner);
59 void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner);
60 void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner);
61 void UpdateSignalsInBuffer();
63 #endif /* SIGNAL_FUNC_H */