|
OpenTTD Source 20251116-master-g21329071df
|
Functions for NewGRF engines. More...
#include "direction_type.h"#include "newgrf_callbacks.h"#include "newgrf_properties.h"#include "vehicle_type.h"#include "engine_type.h"#include "gfx_type.h"#include "newgrf_spritegroup.h"Go to the source code of this file.
Data Structures | |
| struct | VehicleScopeResolver |
| Resolver for a vehicle scope. More... | |
| struct | VehicleResolverObject |
| Resolver for a vehicle (chain) More... | |
Enumerations | |
| enum class | BuildProbabilityType : uint8_t { Reversed = 0 } |
Functions | |
| void | SetWagonOverrideSprites (EngineID engine, CargoType cargo, const struct SpriteGroup *group, std::span< EngineID > engine_ids) |
| const SpriteGroup * | GetWagonOverrideSpriteSet (EngineID engine, CargoType cargo, EngineID overriding_engine) |
| void | SetCustomEngineSprites (EngineID engine, CargoType cargo, const struct SpriteGroup *group) |
| void | GetCustomVehicleSprite (const Vehicle *v, Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) |
| void | GetCustomVehicleIcon (EngineID engine, Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) |
| void | GetCustomRotorSprite (const struct Aircraft *v, EngineImageType image_type, VehicleSpriteSeq *result) |
| void | GetCustomRotorIcon (EngineID engine, EngineImageType image_type, VehicleSpriteSeq *result) |
| void | SetEngineGRF (EngineID engine, const struct GRFFile *file) |
| uint16_t | GetVehicleCallback (CallbackID callback, uint32_t param1, uint32_t param2, EngineID engine, const Vehicle *v, std::span< int32_t > regs100={}) |
| Evaluate a newgrf callback for vehicles. | |
| uint16_t | GetVehicleCallbackParent (CallbackID callback, uint32_t param1, uint32_t param2, EngineID engine, const Vehicle *v, const Vehicle *parent, std::span< int32_t > regs100={}) |
| Evaluate a newgrf callback for vehicles with a different vehicle for parent scope. | |
| bool | UsesWagonOverride (const Vehicle *v) |
| Check if a wagon is currently using a wagon override. | |
| int | GetVehicleProperty (const Vehicle *v, PropertyID property, int orig_value, bool is_signed=false) |
| int | GetEngineProperty (EngineID engine, PropertyID property, int orig_value, const Vehicle *v=nullptr, bool is_signed=false) |
| std::optional< bool > | TestVehicleBuildProbability (Vehicle *v, EngineID engine, BuildProbabilityType type) |
| Test for vehicle build probability type. | |
| void | TriggerVehicleRandomisation (Vehicle *veh, VehicleRandomTrigger trigger) |
| void | AlterVehicleListOrder (EngineID engine, uint16_t target) |
| Record a vehicle ListOrderChange. | |
| void | CommitVehicleListOrderChanges () |
| Determine default engine sorting and execute recorded ListOrderChanges from AlterVehicleListOrder. | |
| EngineID | GetNewEngineID (const GRFFile *file, VehicleType type, uint16_t internal_id) |
| Return the ID of a new engine. | |
| void | FillNewGRFVehicleCache (const Vehicle *v) |
| Fill the grf_cache of the given vehicle. | |
Variables | |
| static const uint | TRAININFO_DEFAULT_VEHICLE_WIDTH = 29 |
| static const uint | ROADVEHINFO_DEFAULT_VEHICLE_WIDTH = 32 |
| static const uint | VEHICLEINFO_FULL_VEHICLE_WIDTH = 32 |
Functions for NewGRF engines.
Definition in file newgrf_engine.h.
|
strong |
Definition at line 104 of file newgrf_engine.h.
| void AlterVehicleListOrder | ( | EngineID | engine, |
| uint16_t | target | ||
| ) |
Record a vehicle ListOrderChange.
| engine | Engine to move |
| target | Local engine ID to move engine in front of |
Definition at line 1345 of file newgrf_engine.cpp.
Referenced by AircraftVehicleChangeInfo(), RailVehicleChangeInfo(), RoadVehicleChangeInfo(), and ShipVehicleChangeInfo().
| void CommitVehicleListOrderChanges | ( | ) |
Determine default engine sorting and execute recorded ListOrderChanges from AlterVehicleListOrder.
Definition at line 1375 of file newgrf_engine.cpp.
References EnginePreSort(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::Get(), EngineOverrideManager::GetID(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::GetNumItems(), Engine::grf_prop, GRFFilePropsBase::grfid, GRFFilePropsBase::local_id, Slide(), and Engine::type.
Referenced by AfterLoadGRFs().
| void FillNewGRFVehicleCache | ( | const Vehicle * | v | ) |
Fill the grf_cache of the given vehicle.
| v | The vehicle to fill the cache for. |
Definition at line 1419 of file newgrf_engine.cpp.
References NewGRFCache::cache_valid, Vehicle::engine_type, VehicleResolverObject::GetScope(), ScopeResolver::GetVariable(), Vehicle::grf_cache, HasBit(), lengthof, NCVV_COMPANY_INFORMATION, NCVV_CONSIST_CARGO_INFORMATION, NCVV_END, NCVV_POSITION_CONSIST_LENGTH, NCVV_POSITION_IN_VEHICLE, NCVV_POSITION_SAME_ID_LENGTH, VSG_SCOPE_SELF, and VehicleResolverObject::WO_NONE.
Referenced by CheckCaches().
| void GetCustomRotorIcon | ( | EngineID | engine, |
| EngineImageType | image_type, | ||
| VehicleSpriteSeq * | result | ||
| ) |
Definition at line 1172 of file newgrf_engine.cpp.
| void GetCustomRotorSprite | ( | const struct Aircraft * | v, |
| EngineImageType | image_type, | ||
| VehicleSpriteSeq * | result | ||
| ) |
Definition at line 1167 of file newgrf_engine.cpp.
| void GetCustomVehicleIcon | ( | EngineID | engine, |
| Direction | direction, | ||
| EngineImageType | image_type, | ||
| VehicleSpriteSeq * | result | ||
| ) |
Definition at line 1130 of file newgrf_engine.cpp.
| void GetCustomVehicleSprite | ( | const Vehicle * | v, |
| Direction | direction, | ||
| EngineImageType | image_type, | ||
| VehicleSpriteSeq * | result | ||
| ) |
Definition at line 1125 of file newgrf_engine.cpp.
| int GetEngineProperty | ( | EngineID | engine, |
| PropertyID | property, | ||
| int | orig_value, | ||
| const Vehicle * | v = nullptr, |
||
| bool | is_signed = false |
||
| ) |
Definition at line 1230 of file newgrf_engine.cpp.
| EngineID GetNewEngineID | ( | const GRFFile * | file, |
| VehicleType | type, | ||
| uint16_t | internal_id | ||
| ) |
Return the ID of a new engine.
| file | The NewGRF file providing the engine. |
| type | The Vehicle type. |
| internal_id | NewGRF-internal ID of the engine. |
Definition at line 296 of file newgrf.cpp.
References _settings_game, VehicleSettings::dynamic_engines, EngineOverrideManager::GetID(), and GameSettings::vehicle.
Referenced by FinaliseEngineArray(), and GetNextArticulatedPart().
| uint16_t GetVehicleCallback | ( | CallbackID | callback, |
| uint32_t | param1, | ||
| uint32_t | param2, | ||
| EngineID | engine, | ||
| const Vehicle * | v, | ||
| std::span< int32_t > | regs100 | ||
| ) |
Evaluate a newgrf callback for vehicles.
| callback | The callback to evaluate | |
| param1 | First parameter of the callback | |
| param2 | Second parameter of the callback | |
| engine | Engine type of the vehicle to evaluate the callback for | |
| v | The vehicle to evaluate the callback for, or nullptr if it doesn't exist yet | |
| [out] | regs100 | Additional result values from registers 100+ |
Definition at line 1198 of file newgrf_engine.cpp.
References VehicleResolverObject::WO_UNCACHED.
Referenced by CalculateRefitMasks(), CmdStartStopVehicle(), Train::ConsistChanged(), Engine::DetermineCapacity(), FormatString(), GetCargoSubtypeText(), GetLoadAmount(), GetNewGRFAdditionalText(), GetNextArticulatedPart(), GetRefitCostFactor(), GetRoadVehLength(), PlayVehicleSound(), RunEconomyVehicleDayProc(), SpawnAdvancedVisualEffect(), TestVehicleBuildProbability(), and Vehicle::UpdateVisualEffect().
| uint16_t GetVehicleCallbackParent | ( | CallbackID | callback, |
| uint32_t | param1, | ||
| uint32_t | param2, | ||
| EngineID | engine, | ||
| const Vehicle * | v, | ||
| const Vehicle * | parent, | ||
| std::span< int32_t > | regs100 | ||
| ) |
Evaluate a newgrf callback for vehicles with a different vehicle for parent scope.
| callback | The callback to evaluate | |
| param1 | First parameter of the callback | |
| param2 | Second parameter of the callback | |
| engine | Engine type of the vehicle to evaluate the callback for | |
| v | The vehicle to evaluate the callback for, or nullptr if it doesn't exist yet | |
| parent | The vehicle to use for parent scope | |
| [out] | regs100 | Additional result values from registers 100+ |
Definition at line 1215 of file newgrf_engine.cpp.
References VehicleResolverObject::WO_NONE.
Referenced by CheckTrainAttachment().
| int GetVehicleProperty | ( | const Vehicle * | v, |
| PropertyID | property, | ||
| int | orig_value, | ||
| bool | is_signed = false |
||
| ) |
Definition at line 1224 of file newgrf_engine.cpp.
| const SpriteGroup * GetWagonOverrideSpriteSet | ( | EngineID | engine, |
| CargoType | cargo, | ||
| EngineID | overriding_engine | ||
| ) |
Definition at line 43 of file newgrf_engine.cpp.
| std::optional< bool > TestVehicleBuildProbability | ( | Vehicle * | v, |
| EngineID | engine, | ||
| BuildProbabilityType | type | ||
| ) |
Test for vehicle build probability type.
| v | Vehicle whose build probability to test. |
| type | Build probability type to test for. |
Definition at line 1251 of file newgrf_engine.cpp.
References CALLBACK_FAILED, CBID_VEHICLE_BUILD_PROBABILITY, GetVehicleCallback(), RandomRange(), and to_underlying().
Referenced by AddArticulatedParts(), BuildReplacementVehicle(), CmdBuildRailVehicle(), CmdBuildRailWagon(), and CmdCloneVehicle().
| void TriggerVehicleRandomisation | ( | Vehicle * | veh, |
| VehicleRandomTrigger | trigger | ||
| ) |
Definition at line 1321 of file newgrf_engine.cpp.
| bool UsesWagonOverride | ( | const Vehicle * | v | ) |
Check if a wagon is currently using a wagon override.
| v | The wagon to check |
Definition at line 1182 of file newgrf_engine.cpp.
References SpecializedVehicle< T, Type >::From(), BaseVehicle::type, and VEH_TRAIN.
Referenced by Train::ConsistChanged(), and GetEngineLiveryScheme().
|
static |
Definition at line 74 of file newgrf_engine.h.
|
static |
Definition at line 73 of file newgrf_engine.h.
|
static |
Definition at line 75 of file newgrf_engine.h.