summaryrefslogtreecommitdiff
path: root/src/rail.h
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2010-07-02 16:34:11 +0000
committermichi_cc <michi_cc@openttd.org>2010-07-02 16:34:11 +0000
commit34f32cbbf47b2cb332b51342c429da93856281d7 (patch)
treecfeca95505173e09a25326035c3d643de143b587 /src/rail.h
parenta75583bbb6d600d51f76edc396279aa0fe6f4c32 (diff)
downloadopenttd-34f32cbbf47b2cb332b51342c429da93856281d7.tar.xz
(svn r20049) -Feature: [NewGRF] Add a railtype flag to disallow level crossings per railtype.
Diffstat (limited to 'src/rail.h')
-rw-r--r--src/rail.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/rail.h b/src/rail.h
index 01af4f369..7a05eda73 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -22,10 +22,12 @@
/** Railtype flags. */
enum RailTypeFlags {
- RTF_CATENARY = 0, ///< Bit number for drawing a catenary.
+ RTF_CATENARY = 0, ///< Bit number for drawing a catenary.
+ RTF_NO_LEVEL_CROSSING = 1, ///< Bit number for disallowing level crossings.
- RTFB_NONE = 0, ///< All flags cleared.
- RTFB_CATENARY = 1 << RTF_CATENARY, ///< Value for drawing a catenary.
+ RTFB_NONE = 0, ///< All flags cleared.
+ RTFB_CATENARY = 1 << RTF_CATENARY, ///< Value for drawing a catenary.
+ RTFB_NO_LEVEL_CROSSING = 1 << RTF_NO_LEVEL_CROSSING, ///< Value for disallowing level crossings.
};
DECLARE_ENUM_AS_BIT_SET(RailTypeFlags)
@@ -259,6 +261,16 @@ static inline bool HasPowerOnRail(RailType enginetype, RailType tiletype)
}
/**
+ * Test if a RailType disallows build of level crossings.
+ * @param rt The RailType to check.
+ * @return Whether level crossings are not allowed.
+ */
+static inline bool RailNoLevelCrossings(RailType rt)
+{
+ return HasBit(GetRailTypeInfo(rt)->flags, RTF_NO_LEVEL_CROSSING);
+}
+
+/**
* Returns the cost of building the specified railtype.
* @param railtype The railtype being built.
* @return The cost multiplier.