summaryrefslogtreecommitdiff
path: root/src/rail_type.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-09 21:05:03 +0000
committerrubidium <rubidium@openttd.org>2008-01-09 21:05:03 +0000
commit998d7644f6a1b58de0b06d539c0436808b1f1e95 (patch)
tree6b9fc11a0135e1ccdb74151dd8962e4fd5264843 /src/rail_type.h
parent82fe2885abb359c813908b0c844533bfec2c2b22 (diff)
downloadopenttd-998d7644f6a1b58de0b06d539c0436808b1f1e95.tar.xz
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
Diffstat (limited to 'src/rail_type.h')
-rw-r--r--src/rail_type.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/rail_type.h b/src/rail_type.h
index 05d28d2b0..c52e0251b 100644
--- a/src/rail_type.h
+++ b/src/rail_type.h
@@ -20,12 +20,27 @@ enum RailType {
INVALID_RAILTYPE = 0xFF ///< Flag for invalid railtype
};
-typedef byte RailTypeMask;
-
/** Allow incrementing of Track variables */
DECLARE_POSTFIX_INCREMENT(RailType);
/** Define basic enum properties */
template <> struct EnumPropsT<RailType> : MakeEnumPropsT<RailType, byte, RAILTYPE_BEGIN, RAILTYPE_END, INVALID_RAILTYPE> {};
typedef TinyEnumT<RailType> RailTypeByte;
+/**
+ * The different roadtypes we support, but then a bitmask of them
+ */
+enum RailTypes {
+ RAILTYPES_NONE = 0, ///< No rail types
+ RAILTYPES_RAIL = 1 << RAILTYPE_RAIL, ///< Non-electrified rails
+ RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC, ///< Electrified rails
+ RAILTYPES_MONO = 1 << RAILTYPE_MONO, ///< Monorail!
+ RAILTYPES_MAGLEV = 1 << RAILTYPE_MAGLEV, ///< Ever fast maglev
+ RAILTYPES_ALL = RAILTYPES_RAIL | RAILTYPES_ELECTRIC | RAILTYPES_MONO | RAILTYPES_MAGLEV, ///< All of them
+ RAILTYPES_END, ///< Used for iterations?
+ INVALID_RAILTYPES = 0xFF ///< Invalid railtypes
+};
+DECLARE_ENUM_AS_BIT_SET(RailTypes);
+template <> struct EnumPropsT<RailTypes> : MakeEnumPropsT<RailTypes, byte, RAILTYPES_NONE, RAILTYPES_END, INVALID_RAILTYPES> {};
+typedef TinyEnumT<RailTypes> RailTypesByte;
+
#endif /* RAIL_TYPE_H */