20 std::vector<EngineID> engines;
73 uint16_t list_position;
83 std::vector<WagonOverride> overrides;
102 return this->info.cargo_type;
151 if (this->display_last_variant == this->
index || this->display_last_variant ==
INVALID_ENGINE)
return this;
205 inline uint64_t Key()
const {
return Key(this->grfid, this->internal_id); }
214 inline size_t operator()(
const EngineIDMapping &eid)
const {
return eid.Key(); }
227 void SetID(
VehicleType type, uint16_t grf_local_id, uint32_t grfid, uint8_t substitute_id,
EngineID engine);
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
Owner
Enum for all companies/owners.
@ MAX_COMPANIES
Maximum number of companies.
EngineDisplayFlags
Flags used client-side in the purchase/autorenew engine list.
@ HasVariants
Set if engine has variants.
@ IsFolded
Set if display of variants should be folded (hidden).
@ Shaded
Set if engine should be masked.
Types related to engines.
static const EngineID INVALID_ENGINE
Constant denoting an invalid engine.
uint16_t EngineID
Unique identification number of an engine.
#define DECLARE_ENUM_AS_BIT_SET(enum_type)
Operators to allow to work with enum as with type safe bit set in C++.
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities.
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Information about a aircraft vehicle.
Projection to get a unique key of an EngineIDMapping, used for sorting in EngineOverrideManager.
VehicleType type
The engine type.
uint32_t grfid
The GRF ID of the file the entity belongs to.
uint8_t substitute_id
The (original) entity ID to use if this GRF is not available (currently not used)
uint16_t internal_id
The internal ID within the GRF file.
Information about a vehicle.
Stores the mapping of EngineID to the internal id of newgrfs.
static bool ResetToCurrentNewGRFConfig()
Tries to reset the engine mapping to match the current NewGRF configuration.
void ResetToDefaultMapping()
Initializes the EngineOverrideManager with the default engines.
EngineID UseUnreservedID(VehicleType type, uint16_t grf_local_id, uint32_t grfid, bool static_access)
Look for an unreserved EngineID matching the local id, and reserve it if found.
EngineID GetID(VehicleType type, uint16_t grf_local_id, uint32_t grfid)
Looks up an EngineID in the EngineOverrideManager.
StringID GetAircraftTypeText() const
Get the name of the aircraft type for display purposes.
uint GetPower() const
Returns the power of the engine for display and sorting purposes.
const Engine * GetDisplayVariant() const
Get the last display variant for an engine.
CargoID GetDefaultCargoType() const
Determines the default cargo type of an engine.
uint16_t GetRange() const
Get the range of an aircraft type.
GRFFilePropsBase< NUM_CARGO+2 > grf_prop
Properties related the the grf file.
uint32_t GetGRFID() const
Retrieve the GRF ID of the NewGRF the engine is tied to.
uint16_t reliability_spd_dec
Speed of reliability decay between services (per day).
Money GetCost() const
Return how much a new engine costs.
uint16_t reliability_start
Initial reliability of the engine.
TimerGameCalendar::Date intro_date
Date of introduction of the engine.
const GRFFile * GetGRF() const
Retrieve the NewGRF the engine is tied to.
static Pool::IterateWrapperFiltered< Engine, EngineTypeFilter > IterateType(VehicleType vt, size_t from=0)
Returns an iterable ensemble of all valid engines of the given type.
uint GetDisplayMaxSpeed() const
Returns max speed of the engine for display purposes.
uint DetermineCapacity(const Vehicle *v, uint16_t *mail_capacity=nullptr) const
Determines capacity of a given vehicle from scratch.
EngineDisplayFlags display_flags
NOSAVE client-side-only display flags for build engine list.
CompanyMask company_avail
Bit for each company whether the engine is available for that company.
uint16_t reliability_max
Maximal reliability of the engine.
uint GetDisplayWeight() const
Returns the weight of the engine for display purposes.
uint8_t original_image_index
Original vehicle image index, thus the image index of the overridden vehicle.
bool IsEnabled() const
Checks whether the engine is a valid (non-articulated part of an) engine.
VehicleType type
Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc.
bool IsVariantHidden(CompanyID c) const
Check whether the engine variant chain is hidden in the GUI for the given company.
uint16_t reliability_final
Final reliability of the engine.
CompanyID preview_company
Company which is currently being offered a preview INVALID_COMPANY means no company.
TimerGameCalendar::Date GetLifeLengthInDays() const
Returns the vehicle's (not model's!) life length in days.
uint GetDisplayDefaultCapacity(uint16_t *mail_capacity=nullptr) const
Determines the default cargo capacity of an engine for display purposes.
uint16_t duration_phase_3
Third reliability phase in months, decaying to reliability_final.
uint16_t duration_phase_2
Second reliability phase in months, keeping reliability_max.
uint8_t preview_wait
Daily countdown timer for timeout of offering the engine to the preview_company company.
CompanyMask company_hidden
Bit for each company whether the engine is normally hidden in the build gui for that company.
Money GetRunningCost() const
Return how much the running costs of this engine are.
uint16_t reliability
Current reliability of the engine.
CompanyMask preview_asked
Bit for each company which has already been offered a preview.
uint GetDisplayMaxTractiveEffort() const
Returns the tractive effort of the engine for display purposes.
int32_t age
Age of the engine in months.
bool IsHidden(CompanyID c) const
Check whether the engine is hidden in the GUI for the given company.
bool CanCarryCargo() const
Determines whether an engine can carry something.
std::string name
Custom name of engine.
EngineID display_last_variant
NOSAVE client-side-only last variant selected.
uint16_t duration_phase_1
First reliability phase in months, increasing reliability from reliability_start to reliability_max.
uint8_t flags
Flags of the engine.
bool IsGroundVehicle() const
Check if the engine is a ground vehicle.
Data related to the handling of grf files.
const struct GRFFile * grffile
grf file that introduced this entity
Dynamic data of a loaded NewGRF.
Base class for all PoolItems.
Tindex index
Index of this pool item.
static Titem * Get(size_t index)
Returns Titem with given index.
Base class for all pools.
Information about a rail vehicle.
Information about a road vehicle.
Information about a ship vehicle.
Templated helper to make a type-safe 'typedef' representing a single POD value.
Definition of the game-calendar-timer.
Types related to vehicles.
VehicleType
Available vehicle types.
@ VEH_ROAD
Road vehicle type.
@ VEH_TRAIN
Train vehicle type.
@ VEH_COMPANY_END
Last company-ownable type.