summaryrefslogtreecommitdiff
path: root/rail_map.h
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-17 19:09:30 +0000
committercelestar <celestar@openttd.org>2006-04-17 19:09:30 +0000
commit01cd0f6fd389a4c46dd8bace0c100f6d82540d4a (patch)
treefb2c3b2221e130d8bc622ad2f50fbbddbb0d8574 /rail_map.h
parent7331bfd36a44cede7ee9684f1fb9d6d7b2e89afd (diff)
downloadopenttd-01cd0f6fd389a4c46dd8bace0c100f6d82540d4a.tar.xz
(svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
Diffstat (limited to 'rail_map.h')
-rw-r--r--rail_map.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/rail_map.h b/rail_map.h
index 2b09faf45..54f766206 100644
--- a/rail_map.h
+++ b/rail_map.h
@@ -211,6 +211,25 @@ static inline void SetSignalVariant(TileIndex t, SignalVariant v)
SB(_m[t].m4, 2, 1, v);
}
+static inline bool IsSignalPresent(TileIndex t, byte signalbit)
+{
+ return HASBIT(_m[t].m3, signalbit + 4);
+}
+
+/** These are states in which a signal can be. Currently these are only two, so
+ * simple boolean logic will do. But do try to compare to this enum instead of
+ * normal boolean evaluation, since that will make future additions easier.
+ */
+typedef enum SignalStates {
+ SIGNAL_STATE_RED = 0,
+ SIGNAL_STATE_GREEN = 1,
+} SignalState;
+
+static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
+{
+ return HASBIT(_m[t].m2, signalbit + 4);
+}
+
typedef enum RailGroundType {
RAIL_MAP2LO_GROUND_MASK = 0xF,