OpenTTD

signal_func.h
Go to the documentation of this file.
1 /* $Id: signal_func.h 17248 2009-08-21 20:21:05Z rubidium $ */
2
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 */
9
12 #ifndef SIGNAL_FUNC_H
13 #define SIGNAL_FUNC_H
14
15 #include "track_type.h"
16 #include "tile_type.h"
17 #include "direction_type.h"
18 #include "company_type.h"
19
24 static inline byte SignalAlongTrackdir(Trackdir trackdir)
25 {
26 extern const byte _signal_along_trackdir[TRACKDIR_END];
27 return _signal_along_trackdir[trackdir];
28 }
29
34 static inline byte SignalAgainstTrackdir(Trackdir trackdir)
35 {
36 extern const byte _signal_against_trackdir[TRACKDIR_END];
37 return _signal_against_trackdir[trackdir];
38 }
39
44 static inline byte SignalOnTrack(Track track)
45 {
46 extern const byte _signal_on_track[TRACK_END];
47 return _signal_on_track[track];
48 }
49
51 enum SigSegState {
52 SIGSEG_FREE,
53 SIGSEG_FULL,
54 SIGSEG_PBS,
55 };
56
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();
62
63 #endif /* SIGNAL_FUNC_H */
track_type.h
All types related to tracks.
SIGSEG_FREE
Free and has no pre-signal exits or at least one green exit.
Definition: signal_func.h:52
direction_type.h
Different types to &#39;show&#39; directions.
AddTrackToSignalBuffer
void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner)
Add track to signal update buffer.
Definition: signal.cpp:582
SIGSEG_FULL
Occupied by a train.
Definition: signal_func.h:53
UpdateSignalsInBuffer
void UpdateSignalsInBuffer()
Update signals in buffer Called from &#39;outside&#39;.
Definition: signal.cpp:566
TRACKDIR_END
Used for iterations.
Definition: track_type.h:92
Track
Track
These are used to specify a single track.
Definition: track_type.h:21
TRACK_END
Used for iterations.
Definition: track_type.h:29
SignalOnTrack
static byte SignalOnTrack(Track track)
Maps a Track to the bits that store the status of the two signals that can be present on the given tr...
Definition: signal_func.h:44
SIGSEG_PBS
Segment is a PBS segment.
Definition: signal_func.h:54
Trackdir
Trackdir
Enumeration for tracks and directions.
Definition: track_type.h:74
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:80
UpdateSignalsOnSegment
SigSegState UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner)
Update signals, starting at one side of a tile Will check tile next to this at opposite side too...
Definition: signal.cpp:640
AddSideToSignalBuffer
void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner)
Add side of tile to signal update buffer.
Definition: signal.cpp:614
SignalAgainstTrackdir
static byte SignalAgainstTrackdir(Trackdir trackdir)
Maps a trackdir to the bit that stores its status in the map arrays, in the direction against the tra...
Definition: signal_func.h:34
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
SignalAlongTrackdir
static byte SignalAlongTrackdir(Trackdir trackdir)
Maps a trackdir to the bit that stores its status in the map arrays, in the direction along with the ...
Definition: signal_func.h:24
SigSegState
SigSegState
State of the signal segment.
Definition: signal_func.h:51
company_type.h
Types related to companies.
SetSignalsOnBothDir
void SetSignalsOnBothDir(TileIndex tile, Track track, Owner owner)
Update signals at segments that are at both ends of given (existent or non-existent) track...
Definition: signal.cpp:658
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:20
tile_type.h
Types related to tiles.