diff options
author | rubidium <rubidium@openttd.org> | 2009-05-26 11:19:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-05-26 11:19:04 +0000 |
commit | b19d0e0254883d0db9d8f3d01dacd94e0229f9ac (patch) | |
tree | 152d2b425ceec441a36bcb95f34afeace8d2ee31 /src | |
parent | 984bd3b98d6a7ad40fdfa9ef74da79dbd7de8840 (diff) | |
download | openttd-b19d0e0254883d0db9d8f3d01dacd94e0229f9ac.tar.xz |
(svn r16428) -Codechange: use the less bloated SimpleTinyEnumT instead of TinyEnumT if the stuff provided by TinyEnumT but not SimpleTinyEnumT is not used.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_station.h | 5 | ||||
-rw-r--r-- | src/order_type.h | 6 | ||||
-rw-r--r-- | src/road_type.h | 3 | ||||
-rw-r--r-- | src/settings_internal.h | 8 | ||||
-rw-r--r-- | src/town_type.h | 6 | ||||
-rw-r--r-- | src/track_type.h | 11 | ||||
-rw-r--r-- | src/vehicle_type.h | 4 |
7 files changed, 12 insertions, 31 deletions
diff --git a/src/newgrf_station.h b/src/newgrf_station.h index 5bd52891b..fa88c4064 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -21,10 +21,7 @@ enum StationClassID { STAT_CLASS_WAYP, ///< Waypoint class. STAT_CLASS_MAX = 32, ///< Maximum number of classes. }; - -/** Define basic enum properties */ -template <> struct EnumPropsT<StationClassID> : MakeEnumPropsT<StationClassID, byte, STAT_CLASS_BEGIN, STAT_CLASS_MAX, STAT_CLASS_MAX> {}; -typedef TinyEnumT<StationClassID> StationClassIDByte; +typedef SimpleTinyEnumT<StationClassID, byte> StationClassIDByte; /** Allow incrementing of StationClassID variables */ DECLARE_POSTFIX_INCREMENT(StationClassID); diff --git a/src/order_type.h b/src/order_type.h index 8823e8a41..33e303370 100644 --- a/src/order_type.h +++ b/src/order_type.h @@ -34,10 +34,8 @@ enum OrderType { OT_END }; -/* It needs to be 8bits, because we save and load it as such */ -/** Define basic enum properties */ -template <> struct EnumPropsT<OrderType> : MakeEnumPropsT<OrderType, byte, OT_BEGIN, OT_END, OT_END> {}; -typedef TinyEnumT<OrderType> OrderTypeByte; +/** It needs to be 8bits, because we save and load it as such */ +typedef SimpleTinyEnumT<OrderType, byte> OrderTypeByte; /** diff --git a/src/road_type.h b/src/road_type.h index 4554de2d3..a50f91c7c 100644 --- a/src/road_type.h +++ b/src/road_type.h @@ -34,8 +34,7 @@ enum RoadTypes { INVALID_ROADTYPES = 0xFF ///< Invalid roadtypes }; DECLARE_ENUM_AS_BIT_SET(RoadTypes); -template <> struct EnumPropsT<RoadTypes> : MakeEnumPropsT<RoadTypes, byte, ROADTYPES_NONE, ROADTYPES_END, INVALID_ROADTYPES> {}; -typedef TinyEnumT<RoadTypes> RoadTypesByte; +typedef SimpleTinyEnumT<RoadTypes, byte> RoadTypesByte; /** diff --git a/src/settings_internal.h b/src/settings_internal.h index 9aaece98f..df3597226 100644 --- a/src/settings_internal.h +++ b/src/settings_internal.h @@ -24,9 +24,7 @@ enum SettingDescTypeLong { SDT_END, /* 10 more possible primitives */ }; - -template <> struct EnumPropsT<SettingDescTypeLong> : MakeEnumPropsT<SettingDescTypeLong, byte, SDT_BEGIN, SDT_END, SDT_END> {}; -typedef TinyEnumT<SettingDescTypeLong> SettingDescType; +typedef SimpleTinyEnumT<SettingDescTypeLong, byte> SettingDescType; enum SettingGuiFlagLong { @@ -42,10 +40,8 @@ enum SettingGuiFlagLong { SGF_NEWGAME_ONLY = 1 << 6, ///< this setting cannot be changed in inside a game SGF_END = 1 << 7, }; - DECLARE_ENUM_AS_BIT_SET(SettingGuiFlagLong); -template <> struct EnumPropsT<SettingGuiFlagLong> : MakeEnumPropsT<SettingGuiFlagLong, byte, SGF_NONE, SGF_END, SGF_END> {}; -typedef TinyEnumT<SettingGuiFlagLong> SettingGuiFlag; +typedef SimpleTinyEnumT<SettingGuiFlagLong, byte> SettingGuiFlag; typedef bool OnChange(int32 var); ///< callback prototype on data modification diff --git a/src/town_type.h b/src/town_type.h index a032c8bea..d56b934df 100644 --- a/src/town_type.h +++ b/src/town_type.h @@ -85,10 +85,8 @@ enum TownLayout { NUM_TLS, ///< Number of town layouts }; -/** It needs to be 8bits, because we save and load it as such - * Define basic enum properties */ -template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_BEGIN, NUM_TLS, NUM_TLS> {}; -typedef TinyEnumT<TownLayout> TownLayoutByte; // typedefing-enumification of TownLayout +/** It needs to be 8bits, because we save and load it as such */ +typedef SimpleTinyEnumT<TownLayout, byte> TownLayoutByte; // typedefing-enumification of TownLayout enum { MAX_LENGTH_TOWN_NAME_BYTES = 31, ///< The maximum length of a town name in bytes including '\0' diff --git a/src/track_type.h b/src/track_type.h index f344a0a49..6177416f5 100644 --- a/src/track_type.h +++ b/src/track_type.h @@ -52,12 +52,8 @@ enum TrackBits { TRACK_BIT_DEPOT = 0x80U, ///< Bitflag for a depot INVALID_TRACK_BIT = 0xFF ///< Flag for an invalid trackbits value }; - -/** Define basic enum properties */ -template <> struct EnumPropsT<TrackBits> : MakeEnumPropsT<TrackBits, byte, TRACK_BIT_NONE, TRACK_BIT_ALL, INVALID_TRACK_BIT> {}; -typedef TinyEnumT<TrackBits> TrackBitsByte; - DECLARE_ENUM_AS_BIT_SET(TrackBits); +typedef SimpleTinyEnumT<TrackBits, byte> TrackBitsByte; /** * Enumeration for tracks and directions. @@ -118,11 +114,8 @@ enum TrackdirBits { TRACKDIR_BIT_MASK = 0x3F3F, ///< Bitmask for bit-operations INVALID_TRACKDIR_BIT = 0xFFFF, ///< Flag for an invalid trackdirbit value }; - -/** Define basic enum properties */ -template <> struct EnumPropsT<TrackdirBits> : MakeEnumPropsT<TrackdirBits, uint16, TRACKDIR_BIT_NONE, TRACKDIR_BIT_MASK, INVALID_TRACKDIR_BIT> {}; -typedef TinyEnumT<TrackdirBits> TrackdirBitsShort; DECLARE_ENUM_AS_BIT_SET(TrackdirBits); +typedef SimpleTinyEnumT<TrackdirBits, uint16> TrackdirBitsShort; typedef uint32 TrackStatus; diff --git a/src/vehicle_type.h b/src/vehicle_type.h index 1bba8defa..c642cfcf5 100644 --- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -20,8 +20,8 @@ enum VehicleType { VEH_INVALID = 0xFF, }; DECLARE_POSTFIX_INCREMENT(VehicleType); -template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID> {}; -typedef TinyEnumT<VehicleType> VehicleTypeByte; +/** It needs to be 8bits, because we save and load it as such */ +typedef SimpleTinyEnumT<VehicleType, byte> VehicleTypeByte; struct Vehicle; struct Train; |