diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2018-10-30 15:54:08 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2018-10-30 21:46:28 +0100 |
commit | f3dbb3f676c8f734de37ebbb1aa755c403483479 (patch) | |
tree | 5f94fe8e14b095abb3cc23e221cde14fc2dcd490 /src | |
parent | 350395a6c2a7e5551421caf7c971f02084c50891 (diff) | |
download | openttd-f3dbb3f676c8f734de37ebbb1aa755c403483479.tar.xz |
Fix #6951: Ensure RailTypes bitfield is always treated as 64 bit
Some compilers (like VC++ 2015) will otherwise narrow it in some contexts where it should not be.
Diffstat (limited to 'src')
-rw-r--r-- | src/rail_type.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rail_type.h b/src/rail_type.h index ebca7ec35..2bd602a37 100644 --- a/src/rail_type.h +++ b/src/rail_type.h @@ -47,9 +47,10 @@ template <> struct EnumPropsT<RailType> : MakeEnumPropsT<RailType, byte, RAILTYP typedef TinyEnumT<RailType> RailTypeByte; /** - * The different roadtypes we support, but then a bitmask of them + * The different railtypes we support, but then a bitmask of them. + * @note Must be treated as a uint64 type, narrowing it causes bit membership tests to give wrong results, as in bug #6951. */ -enum RailTypes { +enum RailTypes : uint64 { RAILTYPES_NONE = 0, ///< No rail types RAILTYPES_RAIL = 1 << RAILTYPE_RAIL, ///< Non-electrified rails RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC, ///< Electrified rails |