OpenTTD Source 20250331-master-g3c15e0c889
newgrf_internal_vehicle.h File Reference

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

EngineGetNewEngine (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, const char *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

ReferenceThroughBaseContainer< std::vector< GRFTempEngineData > > _gted
 Temporary engine data used during NewGRF loading.
 

Detailed Description

NewGRF internal processing state for vehicles.

Definition in file newgrf_internal_vehicle.h.

Function Documentation

◆ CommonVehicleChangeInfo()

ChangeInfoResult CommonVehicleChangeInfo ( EngineInfo ei,
int  prop,
ByteReader buf 
)

◆ ConvertTTDBasePrice()

void ConvertTTDBasePrice ( uint32_t  base_pointer,
const char *  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.

Parameters
base_pointerTTD(P) Base Price Pointer
error_locationFunction name for grf error messages
[out]indexIf 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 324 of file newgrf.cpp.

Referenced by RailVehicleChangeInfo(), and RoadVehicleChangeInfo().

◆ GetNewEngine()

◆ IsValidNewGRFImageIndex()

template<VehicleType T>
static bool IsValidNewGRFImageIndex ( uint8_t  image_index)
inlinestatic

Helper to check whether an image index is valid for a particular NewGRF vehicle.

Template Parameters
TThe type of vehicle.
Parameters
image_indexThe image index to check.
Returns
True iff the image index is valid, or 0xFD (use new graphics).

Definition at line 64 of file newgrf_internal_vehicle.h.

Variable Documentation

◆ _gted