summaryrefslogtreecommitdiff
path: root/src/signal_func.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/signal_func.h')
-rw-r--r--src/signal_func.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/signal_func.h b/src/signal_func.h
new file mode 100644
index 000000000..1dff79429
--- /dev/null
+++ b/src/signal_func.h
@@ -0,0 +1,40 @@
+/* $Id$ */
+
+/** @file signal_func.h Functions related to signals. */
+
+#ifndef SIGNAL_FUNC_H
+#define SIGNAL_FUNC_H
+
+#include "track_type.h"
+
+/**
+ * Maps a trackdir to the bit that stores its status in the map arrays, in the
+ * direction along with the trackdir.
+ */
+static inline byte SignalAlongTrackdir(Trackdir trackdir)
+{
+ extern const byte _signal_along_trackdir[TRACKDIR_END];
+ return _signal_along_trackdir[trackdir];
+}
+
+/**
+ * Maps a trackdir to the bit that stores its status in the map arrays, in the
+ * direction against the trackdir.
+ */
+static inline byte SignalAgainstTrackdir(Trackdir trackdir)
+{
+ extern const byte _signal_against_trackdir[TRACKDIR_END];
+ return _signal_against_trackdir[trackdir];
+}
+
+/**
+ * Maps a Track to the bits that store the status of the two signals that can
+ * be present on the given track.
+ */
+static inline byte SignalOnTrack(Track track)
+{
+ extern const byte _signal_on_track[TRACK_END];
+ return _signal_on_track[track];
+}
+
+#endif /* SIGNAL_FUNC_H */