|
OpenTTD Source 20251104-master-g3befbdd52f
|
NewGRF internal processing state for vehicles. More...
#include "../newgrf.h"#include "../engine_base.h"#include "../vehicle_func.h"#include "newgrf_internal.h"Go to the source code of this file.
Data Structures | |
| struct | GRFTempEngineData |
| Temporary engine data used when loading only. More... | |
Functions | |
| Engine * | GetNewEngine (const GRFFile *file, VehicleType type, uint16_t internal_id, bool static_access=false) |
| Returns the engine associated to a certain internal_id, resp. | |
| void | ConvertTTDBasePrice (uint32_t base_pointer, std::string_view error_location, Price *index) |
| Converts TTD(P) Base Price pointers into the enum used by OTTD See http://wiki.ttdpatch.net/tiki-index.php?page=BaseCosts. | |
| template<VehicleType T> | |
| static bool | IsValidNewGRFImageIndex (uint8_t image_index) |
| Helper to check whether an image index is valid for a particular NewGRF vehicle. | |
| ChangeInfoResult | CommonVehicleChangeInfo (EngineInfo *ei, int prop, ByteReader &buf) |
| Define properties common to all vehicles. | |
Variables | |
| TypedIndexContainer< std::vector< GRFTempEngineData >, EngineID > | _gted |
| Temporary engine data used during NewGRF loading. | |
NewGRF internal processing state for vehicles.
Definition in file newgrf_internal_vehicle.h.
| ChangeInfoResult CommonVehicleChangeInfo | ( | EngineInfo * | ei, |
| int | prop, | ||
| ByteReader & | buf | ||
| ) |
Define properties common to all vehicles.
| ei | Engine info. |
| prop | The property to change. |
| buf | The property value. |
Definition at line 33 of file newgrf_act0.cpp.
References EngineInfo::base_intro, EngineInfo::base_life, CIR_SUCCESS, CIR_UNKNOWN, EngineInfo::climates, TimerGameConst< struct Calendar >::DAYS_TILL_ORIGINAL_BASE_YEAR, EngineInfo::lifelength, PROP_VEHICLE_LOAD_AMOUNT, ByteReader::ReadByte(), and ByteReader::ReadWord().
Referenced by AircraftVehicleChangeInfo(), RailVehicleChangeInfo(), RoadVehicleChangeInfo(), and ShipVehicleChangeInfo().
| void ConvertTTDBasePrice | ( | uint32_t | base_pointer, |
| std::string_view | error_location, | ||
| Price * | index | ||
| ) |
Converts TTD(P) Base Price pointers into the enum used by OTTD See http://wiki.ttdpatch.net/tiki-index.php?page=BaseCosts.
| base_pointer | TTD(P) Base Price Pointer | |
| error_location | Function name for grf error messages | |
| [out] | index | If base_pointer is valid, index is assigned to the matching price; else it is left unchanged |
< Position of first base price
< Size of each base price record
Definition at line 332 of file newgrf.cpp.
Referenced by RailVehicleChangeInfo(), and RoadVehicleChangeInfo().
| Engine * GetNewEngine | ( | const GRFFile * | file, |
| VehicleType | type, | ||
| uint16_t | internal_id, | ||
| bool | static_access | ||
| ) |
Returns the engine associated to a certain internal_id, resp.
allocates it.
| file | NewGRF that wants to change the engine. |
| type | Vehicle type. |
| internal_id | Engine ID inside the NewGRF. |
| static_access | If the engine is not present, return nullptr instead of allocating a new engine. (Used for static Action 0x04). |
Definition at line 214 of file newgrf.cpp.
References _engine_counts, _gted, _settings_game, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::CanAllocateItem(), VehicleSettings::dynamic_engines, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::Get(), GetFileByGRFID(), EngineOverrideManager::GetID(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::GetPoolSize(), GetRailTypeInfo(), Engine::grf_prop, GRFFilePropsBase::HasGrfFile(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, RailTypeInfo::label, GRFFilePropsBase::SetGRFFile(), EngineOverrideManager::UseUnreservedID(), VEH_TRAIN, and GameSettings::vehicle.
Referenced by AircraftVehicleChangeInfo(), RailVehicleChangeInfo(), RoadVehicleChangeInfo(), and ShipVehicleChangeInfo().
|
inlinestatic |
Helper to check whether an image index is valid for a particular NewGRF vehicle.
| T | The type of vehicle. |
| image_index | The image index to check. |
Definition at line 64 of file newgrf_internal_vehicle.h.
References CUSTOM_VEHICLE_SPRITENUM.
|
extern |
Temporary engine data used during NewGRF loading.
Definition at line 78 of file newgrf.cpp.
Referenced by AfterLoadGRFs(), AircraftVehicleChangeInfo(), CalculateRefitMasks(), GetNewEngine(), RailVehicleChangeInfo(), ResetNewGRFData(), RoadVehicleChangeInfo(), and ShipVehicleChangeInfo().