mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Set VehicleType's base type to byte instead of using VehicleTypeByte
This commit is contained in:
parent
96a4787710
commit
69a6c494bf
|
@ -148,7 +148,7 @@ struct Engine : EnginePool::PoolItem<&_engine_pool> {
|
|||
struct EngineIDMapping {
|
||||
uint32 grfid; ///< The GRF ID of the file the entity belongs to
|
||||
uint16 internal_id; ///< The internal ID within the GRF file
|
||||
VehicleTypeByte type; ///< The engine type
|
||||
VehicleType type; ///< The engine type
|
||||
uint8 substitute_id; ///< The (original) entity ID to use if this GRF is not available (currently not used)
|
||||
};
|
||||
|
||||
|
|
16
src/group.h
16
src/group.h
|
@ -65,17 +65,17 @@ struct GroupStatistics {
|
|||
|
||||
/** Group data. */
|
||||
struct Group : GroupPool::PoolItem<&_group_pool> {
|
||||
char *name; ///< Group Name
|
||||
OwnerByte owner; ///< Group Owner
|
||||
VehicleTypeByte vehicle_type; ///< Vehicle type of the group
|
||||
char *name; ///< Group Name
|
||||
OwnerByte owner; ///< Group Owner
|
||||
VehicleType vehicle_type; ///< Vehicle type of the group
|
||||
|
||||
bool replace_protection; ///< If set to true, the global autoreplace have no effect on the group
|
||||
Livery livery; ///< Custom colour scheme for vehicles in this group
|
||||
GroupStatistics statistics; ///< NOSAVE: Statistics and caches on the vehicles in the group.
|
||||
bool replace_protection; ///< If set to true, the global autoreplace have no effect on the group
|
||||
Livery livery; ///< Custom colour scheme for vehicles in this group
|
||||
GroupStatistics statistics; ///< NOSAVE: Statistics and caches on the vehicles in the group.
|
||||
|
||||
bool folded; ///< NOSAVE: Is this group folded in the group view?
|
||||
bool folded; ///< NOSAVE: Is this group folded in the group view?
|
||||
|
||||
GroupID parent; ///< Parent group
|
||||
GroupID parent; ///< Parent group
|
||||
|
||||
Group(CompanyID owner = INVALID_COMPANY);
|
||||
~Group();
|
||||
|
|
|
@ -657,7 +657,7 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern
|
|||
_engine_mngr.push_back({
|
||||
scope_grfid, // Note: this is INVALID_GRFID if dynamic_engines is disabled, so no reservation
|
||||
internal_id,
|
||||
{static_cast<byte>(type)},
|
||||
type,
|
||||
static_cast<uint8>(min(internal_id, _engine_counts[type])) // substitute_id == _engine_counts[subtype] means "no substitute"
|
||||
});
|
||||
|
||||
|
|
|
@ -566,7 +566,7 @@ static inline uint32 GetSmallMapOwnerPixels(TileIndex tile, TileType t)
|
|||
return MKCOLOUR_XXXX(_legend_land_owners[_company_to_list_pos[o]].colour);
|
||||
}
|
||||
|
||||
/** Vehicle colours in #SMT_VEHICLES mode. Indexed by #VehicleTypeByte. */
|
||||
/** Vehicle colours in #SMT_VEHICLES mode. Indexed by #VehicleType. */
|
||||
static const byte _vehicle_type_colours[6] = {
|
||||
PC_RED, PC_YELLOW, PC_LIGHT_BLUE, PC_WHITE, PC_BLACK, PC_RED
|
||||
};
|
||||
|
|
|
@ -19,8 +19,8 @@ typedef uint32 VehicleID;
|
|||
|
||||
static const int GROUND_ACCELERATION = 9800; ///< Acceleration due to gravity, 9.8 m/s^2
|
||||
|
||||
/** Available vehicle types. */
|
||||
enum VehicleType {
|
||||
/** Available vehicle types. It needs to be 8bits, because we save and load it as such */
|
||||
enum VehicleType : byte {
|
||||
VEH_BEGIN,
|
||||
|
||||
VEH_TRAIN = VEH_BEGIN, ///< %Train vehicle type.
|
||||
|
@ -39,8 +39,6 @@ enum VehicleType {
|
|||
DECLARE_POSTFIX_INCREMENT(VehicleType)
|
||||
/** Helper information for extract tool. */
|
||||
template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID, 3> {};
|
||||
/** It needs to be 8bits, because we save and load it as such */
|
||||
typedef SimpleTinyEnumT<VehicleType, byte> VehicleTypeByte;
|
||||
|
||||
struct Vehicle;
|
||||
struct Train;
|
||||
|
@ -53,7 +51,7 @@ struct DisasterVehicle;
|
|||
/** Base vehicle class. */
|
||||
struct BaseVehicle
|
||||
{
|
||||
VehicleTypeByte type; ///< Type of vehicle
|
||||
VehicleType type; ///< Type of vehicle
|
||||
};
|
||||
|
||||
static const VehicleID INVALID_VEHICLE = 0xFFFFF; ///< Constant representing a non-existing vehicle.
|
||||
|
|
Loading…
Reference in New Issue