(svn r20049) -Feature: [NewGRF] Add a railtype flag to disallow level crossings per railtype.

This commit is contained in:
michi_cc
2010-07-02 16:34:11 +00:00
parent a75583bbb6
commit 34f32cbbf4
7 changed files with 29 additions and 3 deletions

View File

@@ -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)
@@ -258,6 +260,16 @@ static inline bool HasPowerOnRail(RailType enginetype, RailType tiletype)
return HasBit(GetRailTypeInfo(enginetype)->powered_railtypes, 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.