Changeset - r23661:3655a2df3316
[Not reviewed]
master
0 5 0
Charles Pigott - 5 years ago 2019-04-21 21:25:54
charlespigott@googlemail.com
Codechange: Set VehicleType's base type to byte instead of using VehicleTypeByte
5 files changed with 14 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/engine_base.h
Show inline comments
 
@@ -148,7 +148,7 @@ struct Engine : EnginePool::PoolItem<&_e
 
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)
 
};
 

	
src/group.h
Show inline comments
 
@@ -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();
src/newgrf.cpp
Show inline comments
 
@@ -657,7 +657,7 @@ static Engine *GetNewEngine(const GRFFil
 
	_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"
 
	});
 

	
src/smallmap_gui.cpp
Show inline comments
 
@@ -566,7 +566,7 @@ static inline uint32 GetSmallMapOwnerPix
 
	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
 
};
src/vehicle_type.h
Show inline comments
 
@@ -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.
0 comments (0 inline, 0 general)