Changeset - r23021:aa126cdbf65b
[Not reviewed]
master
0 1 0
Niels Martin Hansen - 6 years ago 2018-10-30 14:54:08
nielsm@indvikleren.dk
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.
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/rail_type.h
Show inline comments
 
@@ -47,9 +47,10 @@ template <> struct EnumPropsT<RailType> 
 
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
0 comments (0 inline, 0 general)