Go to the documentation of this file.
34 #include "table/strings.h"
55 lengthof(_orig_aircraft_vehicle_info),
74 this->list_position = base;
85 if (
type ==
VEH_ROAD) this->u.road.tractive_effort = 0x4C;
107 default: NOT_REACHED();
110 this->u.rail = _orig_rail_vehicle_info[base];
112 this->info.
string_id = STR_VEHICLE_NAME_TRAIN_ENGINE_RAIL_KIRBY_PAUL_TANK_STEAM + base;
120 this->u.road = _orig_road_vehicle_info[base];
122 this->info.
string_id = STR_VEHICLE_NAME_ROAD_VEHICLE_MPS_REGAL_BUS + base;
126 this->u.ship = _orig_ship_vehicle_info[base];
128 this->info.
string_id = STR_VEHICLE_NAME_SHIP_MPS_OIL_TANKER + base;
132 this->u.air = _orig_aircraft_vehicle_info[base];
134 this->info.
string_id = STR_VEHICLE_NAME_AIRCRAFT_SAMPSON_U52 + base;
156 return file ==
nullptr ? 0 : file->grfid;
171 switch (this->type) {
173 if (this->u.rail.capacity == 0)
return false;
177 if (this->u.road.capacity == 0)
return false;
184 default: NOT_REACHED();
200 if (mail_capacity !=
nullptr) *mail_capacity = 0;
214 (new_multipliers || default_cargo != cargo_type || (v !=
nullptr && v->
cargo_subtype != 0))) {
221 uint extra_mail_cap = 0;
222 switch (this->type) {
227 if (v ==
nullptr && this->u.rail.railveh_type ==
RAILVEH_MULTIHEAD) capacity += this->u.rail.capacity;
243 if (!new_multipliers && cargo_type == CT_MAIL)
return capacity + extra_mail_cap;
244 default_cargo = CT_PASSENGERS;
247 default: NOT_REACHED();
250 if (!new_multipliers) {
252 capacity += extra_mail_cap;
257 if (new_multipliers || (this->type !=
VEH_SHIP && default_cargo != cargo_type)) {
260 capacity *= cargo_multiplier;
261 if (extra_mail_cap > 0) {
263 capacity += (default_multiplier * extra_mail_cap * cargo_multiplier + mail_multiplier / 2) / mail_multiplier;
265 capacity = (capacity + default_multiplier / 2) / default_multiplier;
279 switch (this->type) {
281 base_price = this->u.road.running_cost_class;
282 if (base_price == INVALID_PRICE)
return 0;
287 base_price = this->u.rail.running_cost_class;
288 if (base_price == INVALID_PRICE)
return 0;
293 base_price = PR_RUNNING_SHIP;
298 base_price = PR_RUNNING_AIRCRAFT;
302 default: NOT_REACHED();
316 switch (this->type) {
318 base_price = PR_BUILD_VEHICLE_ROAD;
324 base_price = PR_BUILD_VEHICLE_WAGON;
327 base_price = PR_BUILD_VEHICLE_TRAIN;
333 base_price = PR_BUILD_VEHICLE_SHIP;
338 base_price = PR_BUILD_VEHICLE_AIRCRAFT;
342 default: NOT_REACHED();
354 switch (this->type) {
360 return (max_speed != 0) ? max_speed * 2 : this->u.road.max_speed / 2;
368 if (max_speed != 0) {
369 return (max_speed * 128) / 10;
371 return this->u.air.max_speed;
374 default: NOT_REACHED();
387 switch (this->type) {
393 default: NOT_REACHED();
405 switch (this->type) {
411 default: NOT_REACHED();
423 switch (this->type) {
429 default: NOT_REACHED();
449 switch (this->type) {
453 default: NOT_REACHED();
463 switch (this->type) {
465 switch (this->u.air.subtype) {
466 case AIR_HELI:
return STR_LIVERY_HELICOPTER;
467 case AIR_CTOL:
return STR_LIVERY_SMALL_PLANE;
468 case AIR_CTOL | AIR_FAST:
return STR_LIVERY_LARGE_PLANE;
469 default: NOT_REACHED();
472 default: NOT_REACHED();
483 for (uint internal_id = 0; internal_id <
_engine_counts[type]; internal_id++) {
486 eid.
grfid = INVALID_GRFID;
541 [[maybe_unused]] uint index = 0;
546 [[maybe_unused]]
const Engine *e =
new Engine(eid.type, eid.internal_id);
547 assert(e->
index == index);
552 void ShowEnginePreviewWindow(
EngineID engine);
573 if (e->display_last_variant == engine_id) e->display_last_variant =
INVALID_ENGINE;
596 if (retire_early != 0 && age >= retire_early_max_age) {
604 if (age < e->duration_phase_1) {
689 (re->
index << 16) ^ (re->info.
base_intro << 12) ^ (re->info.decay_speed << 8) ^
723 uint32 seed = Random();
819 if (recursion_depth >= 10)
return;
841 int32 best_hist = -1;
844 c->old_economy[0].performance_history > best_hist) {
848 if (v->owner != c->index || v->type != e->
type)
continue;
849 if (!v->GetEngine()->CanCarryCargo() || !
HasBit(cargomask, v->cargo_type))
continue;
851 best_hist = c->old_economy[0].performance_history;
852 best_company = c->index;
876 default: NOT_REACHED();
894 if (!--e->preview_wait) {
902 e->preview_asked = (CompanyMask)-1;
906 SetBit(e->preview_asked, e->preview_company);
907 e->preview_wait = 20;
927 SB(e->company_hidden, cid, 1, 0);
1007 uint block_preview = c->block_preview;
1012 c->block_preview = 20;
1017 if (v->owner == c->index && v->engine_type == index) {
1019 c->block_preview = block_preview;
1069 bool refresh =
false;
1079 if (!e->IsEnabled())
continue;
1092 if (
IsWagon(e->index))
continue;
1100 e->preview_asked = 0;
1121 if (!e->name.empty() && e->name == name)
return false;
1139 bool reset = text.empty();
1173 if (e ==
nullptr)
return false;
1176 if (e->
type != type)
return false;
1214 if (e ==
nullptr)
return false;
1219 if (ei->refit_mask == 0)
return false;
1227 CargoTypes default_cargo_mask = 0;
1228 SetBit(default_cargo_mask, default_cargo);
1229 return default_cargo !=
CT_INVALID && ei->refit_mask != default_cargo_mask;
1237 Date min_date = INT32_MAX;
1240 if (!e->IsEnabled())
continue;
1249 min_date = std::min(min_date, e->info.base_intro);
1252 if (min_date < INT32_MAX) {
@ VEH_AIRCRAFT
Aircraft vehicle type.
RailTypes AddDateIntroducedRailTypes(RailTypes current, Date date)
Add the rail types that are to be introduced at the given date.
static const EngineID INVALID_ENGINE
Constant denoting an invalid engine.
Year base_life
Basic duration of engine availability (without random parts). 0xFF means infinite life.
static bool IsCompanyBuildableVehicleType(VehicleType type)
Is the given vehicle type buildable by a company?
UnitID max_aircraft
max planes in game per company
uint32 GetGRFID() const
Retrieve the GRF ID of the NewGRF the engine is tied to.
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
void CheckEngines()
Check for engines that have an appropriate availability.
@ PROP_TRAIN_SPEED
Max. speed: 1 unit = 1/1.6 mph = 1 km-ish/h.
uint32 generation_seed
noise seed for world generation
@ ROADTYPE_END
Used for iterations.
static Pool::IterateWrapperFiltered< Engine, EngineTypeFilter > IterateType(VehicleType vt, size_t from=0)
Returns an iterable ensemble of all valid engines of the given type.
static bool ResetToCurrentNewGRFConfig()
Tries to reset the engine mapping to match the current NewGRF configuration.
static Titem * Get(size_t index)
Returns Titem with given index.
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
void ResetToDefaultMapping()
Initializes the EngineOverrideManager with the default engines.
@ PROP_TRAIN_CARGO_CAPACITY
Capacity (if dualheaded: for each single vehicle)
bool ai_disable_veh_roadveh
disable types for AI
@ PROP_ROADVEH_TRACTIVE_EFFORT
Tractive effort coefficient in 1/256.
void ReloadNewGRFData()
Reload all NewGRF files during a running game.
uint32 grfid
The GRF ID of the file the entity belongs to.
uint16 reliability_max
Maximal reliability of the engine.
Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
Determine a certain price.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
uint16 duration_phase_3
Third reliability phase in months, decaying to reliability_final.
@ PROP_ROADVEH_COST_FACTOR
Purchase cost.
uint64 PackEngineNameDParam(EngineID engine_id, EngineNameContext context, uint32 extra_data=0)
Combine an engine ID and a name context to an engine name dparam.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
void CalcEngineReliability(Engine *e, bool new_month)
Update Engine::reliability and (if needed) update the engine GUIs.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
RailTypes avail_railtypes
Rail types available to this company.
@ WL_WARNING
Other information.
@ PROP_TRAIN_RUNNING_COST_FACTOR
Yearly runningcost (if dualheaded: sum of both vehicles)
byte landscape
the landscape we're currently in
uint16 reliability_spd_dec
Speed of reliability decay between services (per day).
RoadTypes introduces_roadtypes
Bitmask of which other roadtypes are introduced when this roadtype is introduced.
RoadTypes avail_roadtypes
Road types available to this company.
const uint8 _engine_counts[4]
Number of engines of each vehicle type in original engine data.
static bool IsWagon(EngineID index)
Determine whether an engine type is a wagon (and not a loco).
static CompanyID GetPreviewCompany(Engine *e)
Get the best company for an engine preview.
Year _cur_year
Current year, starting at 0.
@ PROP_TRAIN_TRACTIVE_EFFORT
Tractive effort coefficient in 1/256.
void EnginesDailyLoop()
Daily check to offer an exclusive engine preview to the companies.
virtual void CleanPool()
Virtual method that deletes all items in the pool.
static Year _year_engine_aging_stops
Year that engine aging stops.
void StartupOneEngine(Engine *e, Date aging_date, uint32 seed)
Start/initialise one engine.
Price
Enumeration of all base prices for use with Prices.
@ PROP_AIRCRAFT_MAIL_CAPACITY
Mail Capacity.
CompanyMask company_avail
Bit for each company whether the engine is available for that company.
@ WC_ENGINE_PREVIEW
Engine preview window; Window numbers:
uint GetDisplayMaxTractiveEffort() const
Returns the tractive effort of the engine for display purposes.
@ VE_DEFAULT
Default value to indicate that visual effect should be based on engine class.
Stores the state of all random number generators.
Tindex index
Index of this pool item.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
@ PROP_SHIP_CARGO_CAPACITY
Capacity.
uint16 duration_phase_1
First reliability phase in months, increasing reliability from reliability_start to reliability_max.
@ PROP_AIRCRAFT_RUNNING_COST_FACTOR
Yearly runningcost.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static void EnableEngineForCompany(EngineID eid, CompanyID company)
Allows engine eid to be used by a company company.
static void SaveRandomSeeds(SavedRandomSeeds *storage)
Saves the current seeds.
Money GetRunningCost() const
Return how much the running costs of this engine are.
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1=NR_NONE, uint32 ref1=UINT32_MAX, NewsReferenceType reftype2=NR_NONE, uint32 ref2=UINT32_MAX, const NewsAllocatedData *data=nullptr)
Add a new newsitem to be shown.
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
uint16 reliability_start
Initial reliability of the engine.
StringID GetEngineCategoryName(EngineID engine)
Return the category of an engine.
int32 Year
Type for the year, note: 0 based, i.e. starts at the year 0.
void SetupEngines()
Initialise the engine pool with the data from the original vehicles.
RoadTypes AddDateIntroducedRoadTypes(RoadTypes current, Date date)
Add the road types that are to be introduced at the given date.
@ TRANSPORT_WATER
Transport over water.
CompanyID preview_company
Company which is currently being offered a preview INVALID_COMPANY means no company.
RoadTypes GetCompanyRoadTypes(CompanyID company, bool introduces)
Get the road types the given company can build.
Date GetLifeLengthInDays() const
Returns the vehicle's (not model's!) life length in days.
Information about a vehicle.
Date base_intro
Basic date of engine introduction (without random parts).
@ CBM_VEHICLE_CARGO_SUFFIX
Show suffix after cargo name.
#define MAX_DAY
The number of days till the last day.
@ NoPreview
No exclusive preview will be offered.
@ VEH_ROAD
Road vehicle type.
@ CC_PASSENGERS
Passengers.
uint16 internal_id
The internal ID within the GRF file.
CargoID GetDefaultCargoType() const
Determines the default cargo type of an engine.
CompanyMask company_hidden
Bit for each company whether the engine is normally hidden in the build gui for that company.
RoadType roadtype
Road type.
void StartupEngines()
Start/initialise all our engines.
Owner
Enum for all companies/owners.
uint16 GetVehicleCallback(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v)
Evaluate a newgrf callback for vehicles.
@ DC_EXEC
execute the given command
static void DisableEngineForCompany(EngineID eid, CompanyID company)
Forbids engine eid to be used by a company company.
EngineID GetID(VehicleType type, uint16 grf_local_id, uint32 grfid)
Looks up an EngineID in the EngineOverrideManager.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
DoCommandFlag
List of flags for a command.
static void RestoreRandomSeeds(const SavedRandomSeeds &storage)
Restores previously saved seeds.
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=nullptr, uint textref_stack_size=0, const uint32 *textref_stack=nullptr)
Display an error message in a window.
static uint CountBits(T value)
Counts the number of set bits in a variable.
byte extend_vehicle_life
extend vehicle life by this many years
GameCreationSettings game_creation
settings used during the creation of a game (map)
CommandCost CmdWantEnginePreview(DoCommandFlag flags, EngineID engine_id)
Accept an engine prototype.
@ NR_ENGINE
Reference engine.
Year lifelength
Lifetime of a single vehicle.
const GRFFile * GetGRF() const
Retrieve the NewGRF the engine is tied to.
static bool IsUniqueEngineName(const std::string &name)
Is name still free as name for an engine?
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
@ ENGINE_EXCLUSIVE_PREVIEW
This vehicle is in the exclusive preview stage, either being used or being offered to a company.
EngineID display_last_variant
NOSAVE client-side-only last variant selected.
uint GetDisplayMaxSpeed() const
Returns max speed of the engine for display purposes.
size_t Utf8StringLength(const char *s)
Get the length of an UTF-8 encoded string in number of characters and thus not the number of bytes th...
static void AcceptEnginePreview(EngineID eid, CompanyID company, int recursion_depth=0)
Company company accepts engine eid for preview.
@ PROP_ROADVEH_SPEED
Max. speed: 1 unit = 1/0.8 mph = 2 km-ish/h.
static bool IsVehicleTypeDisabled(VehicleType type, bool ai)
Checks if a vehicle type is disabled for all/ai companies.
uint16 EngineID
Unique identification number of an engine.
RoadTypes powered_roadtypes
bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype generates power
@ NT_NEW_VEHICLES
New vehicle has become available.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
bool ai_disable_veh_train
disable types for AI
static void NewEvent(CompanyID company, ScriptEvent *event)
Queue a new event for an AI.
Common return value for all commands.
Date _date
Current date in days (day counter)
CargoTypes GetUnionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type)
Ors the refit_masks of all articulated parts.
UnitID max_ships
max ships in game per company
static const int CARGO_AGING_TICKS
cycle duration for aging cargo
EngineID engine_type
The type of engine used for this vehicle.
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
Date ConvertYMDToDate(Year year, Month month, Day day)
Converts a tuple of Year, Month and Day to a Date.
static const int GROUND_ACCELERATION
Acceleration due to gravity, 9.8 m/s^2.
static const uint MAX_LENGTH_ENGINE_NAME_CHARS
The maximum length of an engine name in characters including '\0'.
int32 Date
The type to store our dates in.
CompanyMask preview_asked
Bit for each company which has already been offered a preview.
@ WC_REPLACE_VEHICLE
Replace vehicle window; Window numbers:
GameSettings _settings_game
Game settings of a running game or the scenario editor.
uint GetDisplayWeight() const
Returns the weight of the engine for display purposes.
void ConvertDateToYMD(Date date, YearMonthDay *ymd)
Converts a Date to a Year, Month & Day.
@ MAX_COMPANIES
Maximum number of companies.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
static void BroadcastNewEvent(ScriptEvent *event, CompanyID skip_company=MAX_COMPANIES)
Broadcast a new event to all active AIs.
static bool IsInteractiveCompany(CompanyID company)
Is the user representing company?
uint16 callback_mask
Bitmask of vehicle callbacks that have to be called.
@ SyncReliability
Engine reliability will be synced with variant parent.
void EnginesMonthlyLoop()
Monthly update of the availability, reliability, and preview offers of the engines.
@ NoNews
No 'new vehicle' news will be generated.
int8 retire_early
Number of years early to retire vehicle.
static const int DAYS_IN_LEAP_YEAR
sometimes, you need one day more...
uint8 substitute_id
The (original) entity ID to use if this GRF is not available (currently not used)
Money GetCost() const
Return how much a new engine costs.
VehicleType
Available vehicle types.
@ PROP_AIRCRAFT_COST_FACTOR
Purchase cost.
@ ENGINE_AVAILABLE
This vehicle is available to everyone.
byte misc_flags
Miscellaneous flags.
@ PROP_SHIP_RUNNING_COST_FACTOR
Yearly runningcost.
@ RAILVEH_WAGON
simple wagon, not motorized
@ CBM_VEHICLE_REFIT_CAPACITY
Cargo capacity after refit.
uint16 reliability_final
Final reliability of the engine.
const uint8 _engine_offsets[4]
Offset of the first engine of each vehicle type in original engine data.
static void ClearLastVariant(EngineID engine_id, VehicleType type)
Ensure engine is not set as the last used variant for any other engine.
AISettings ai
what may the AI do?
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
bool ai_disable_veh_ship
disable types for AI
CompanyID _current_company
Company currently doing an action.
@ PROP_TRAIN_WEIGHT
Weight in t (if dualheaded: for each single vehicle)
std::string name
Custom name of engine.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Base class for all pools.
@ JoinPreview
Engine will join exclusive preview with variant parent.
bool CanCarryCargo() const
Determines whether an engine can carry something.
CommandCost CmdSetVehicleVisibility(DoCommandFlag flags, EngineID engine_id, bool hide)
Set the visibility of an engine.
UnitID max_trains
max trains in game per company
void SetRandomSeed(uint32 seed)
(Re)set the state of the random number generators.
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
static Aircraft * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
uint GetPower() const
Returns the power of the engine for display and sorting purposes.
@ RAILTYPE_END
Used for iterations.
@ EF_NO_DEFAULT_CARGO_MULTIPLIER
Use the new capacity algorithm. The default cargotype of the vehicle does not affect capacity multipl...
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
bool IsNormalAircraft() const
Check if the aircraft type is a normal flying device; eg not a rotor or a shadow.
CommandCost CmdRenameEngine(DoCommandFlag flags, EngineID engine_id, const std::string &text)
Rename an engine.
Stores the mapping of EngineID to the internal id of newgrfs.
@ RAILVEH_MULTIHEAD
indicates a combination of two locomotives
EngineID variant_id
Engine variant ID. If set, will be treated specially in purchase lists.
RailTypes GetCompanyRailtypes(CompanyID company, bool introduces)
Get the rail types the given company can build.
bool ai_disable_veh_aircraft
disable types for AI
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
static const int DAYS_IN_YEAR
days per year
static const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
@ TRANSPORT_AIR
Transport through air.
static void NewVehicleAvailable(Engine *e)
An engine has become available for general use.
RailType railtype
Railtype, mangled if elrail is disabled.
@ PROP_ROADVEH_CARGO_CAPACITY
Capacity.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
Year starting_year
starting date
UnitID max_roadveh
max trucks in game per company
uint8 original_image_index
Original vehicle image index, thus the image index of the overridden vehicle.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
uint16 multiplier
Capacity multiplier for vehicles. (8 fractional bits)
@ AIR_CTOL
Conventional Take Off and Landing, i.e. planes.
@ NF_VEHICLE
Vehicle news item. (new engine available)
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
#define lengthof(x)
Return the length of an fixed size array.
Data structure to convert between Date and triplet (year, month, and day).
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
@ CBID_VEHICLE_REFIT_CAPACITY
Refit capacity, the passed vehicle needs to have its ->cargo_type set to the cargo we are refitting t...
uint DetermineCapacity(const Vehicle *v, uint16 *mail_capacity=nullptr) const
Determines capacity of a given vehicle from scratch.
byte CargoID
Cargo slots to indicate a cargo type within a game.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
bool never_expire_vehicles
never expire vehicles
bool IsEnabled() const
Checks whether the engine is a valid (non-articulated part of an) engine.
CommandCost CmdEngineCtrl(DoCommandFlag flags, EngineID engine_id, CompanyID company_id, bool allow)
Allow or forbid a specific company to use an engine.
@ INVALID_COMPANY
An invalid company.
@ PROP_SHIP_COST_FACTOR
Purchase cost.
@ TRANSPORT_ROAD
Transport by road vehicle.
CargoID cargo_type
type of cargo this vehicle is carrying
GRFFilePropsBase< NUM_CARGO+2 > grf_prop
Properties related the the grf file.
uint16 local_id
id defined by the grf file for this entity
VehicleSettings vehicle
options for vehicles
byte cargo_subtype
Used for livery refits (NewGRF variations)
byte climates
Climates supported by the engine.
@ PROP_SHIP_SPEED
Max. speed: 1 unit = 1/3.2 mph = 0.5 km-ish/h.
@ PROP_AIRCRAFT_PASSENGER_CAPACITY
Passenger Capacity.
bool IsEngineRefittable(EngineID engine)
Check if an engine is refittable.
@ PROP_ROADVEH_POWER
Power in 10 HP.
@ VEH_TRAIN
Train vehicle type.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
@ PROP_TRAIN_COST_FACTOR
Purchase cost (if dualheaded: sum of both vehicles)
@ PROP_AIRCRAFT_SPEED
Max. speed: 1 unit = 8 mph = 12.8 km-ish/h.
uint16 GetRange() const
Get the range of an aircraft type.
VehicleType type
The engine type.
byte flags
Flags of the engine.
StringID string_id
Default name of engine.
void ClearEnginesHiddenFlagOfCompany(CompanyID cid)
Clear the 'hidden' flag for all engines of a new company.
@ CT_INVALID
Invalid cargo type.
static bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
@ PROP_TRAIN_POWER
Power in hp (if dualheaded: sum of both vehicles)
void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type)
When an engine is made buildable or is removed from being buildable, add/remove it from the build/aut...
@ VEH_SHIP
Ship vehicle type.
@ ROADTYPES_NONE
No roadtypes.
@ PROP_ROADVEH_RUNNING_COST_FACTOR
Yearly runningcost.
@ WC_MAIN_TOOLBAR
Main toolbar (the long bar at the top); Window numbers:
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
@ PROP_AIRCRAFT_RANGE
Aircraft range.
uint16 cargo_age_period
Number of ticks before carried cargo is aged.
void SetYearEngineAgingStops()
Compute the value for _year_engine_aging_stops.
bool IsEngineBuildable(EngineID engine, VehicleType type, CompanyID company)
Check if an engine is buildable.
Date intro_date
Date of introduction of the engine.
StringID GetAircraftTypeText() const
Get the name of the aircraft type for display purposes.
static const uint NUM_DEFAULT_ENGINES
Number of default entries.
Dynamic data of a loaded NewGRF.
uint16 reliability
Current reliability of the engine.
@ PreviewNews
Name is shown in exclusive preview or newspaper.
VehicleType type
Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc.
uint16 duration_phase_2
Second reliability phase in months, keeping reliability_max.
@ PROP_ROADVEH_WEIGHT
Weight in 1/4 t.
RailTypes introduces_railtypes
Bitmask of which other railtypes are introduced when this railtype is introduced.