(svn r16428) -Codechange: use the less bloated SimpleTinyEnumT instead of TinyEnumT if the stuff provided by TinyEnumT but not SimpleTinyEnumT is not used.

This commit is contained in:
rubidium 2009-05-26 11:19:04 +00:00
parent 984bd3b98d
commit b19d0e0254
7 changed files with 12 additions and 31 deletions

View File

@ -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);

View File

@ -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;
/**

View File

@ -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;
/**

View File

@ -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

View File

@ -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'

View File

@ -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;

View File

@ -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;