OpenTTD Source 20241224-master-gf74b0cf984
GroundVehicleCache Struct Reference

Cached, frequently calculated values. More...

#include <ground_vehicle.hpp>

Public Member Functions

auto operator<=> (const GroundVehicleCache &) const =default
 

Data Fields

uint32_t cached_weight
 Total weight of the consist (valid only for the first engine).
 
uint32_t cached_slope_resistance
 Resistance caused by weight when this vehicle part is at a slope.
 
uint32_t cached_max_te
 Maximum tractive effort of consist (valid only for the first engine).
 
uint16_t cached_axle_resistance
 Resistance caused by the axles of the vehicle (valid only for the first engine).
 
uint16_t cached_max_track_speed
 Maximum consist speed (in internal units) limited by track type (valid only for the first engine).
 
uint32_t cached_power
 Total power of the consist (valid only for the first engine).
 
uint32_t cached_air_drag
 Air drag coefficient of the vehicle (valid only for the first engine).
 
uint16_t cached_total_length
 Length of the whole vehicle (valid only for the first engine).
 
EngineID first_engine
 Cached EngineID of the front vehicle. INVALID_ENGINE for the front vehicle itself.
 
uint8_t cached_veh_length
 Length of this vehicle in units of 1/VEHICLE_LENGTH of normal length. It is cached because this can be set by a callback.
 
uint16_t last_speed
 The last speed we did display, so we only have to redraw when this changes.
 

Detailed Description

Cached, frequently calculated values.

All of these values except cached_slope_resistance are set only for the first part of a vehicle.

Definition at line 30 of file ground_vehicle.hpp.

Field Documentation

◆ cached_air_drag

uint32_t GroundVehicleCache::cached_air_drag

Air drag coefficient of the vehicle (valid only for the first engine).

Definition at line 40 of file ground_vehicle.hpp.

◆ cached_axle_resistance

uint16_t GroundVehicleCache::cached_axle_resistance

Resistance caused by the axles of the vehicle (valid only for the first engine).

Definition at line 35 of file ground_vehicle.hpp.

◆ cached_max_te

uint32_t GroundVehicleCache::cached_max_te

Maximum tractive effort of consist (valid only for the first engine).

Definition at line 34 of file ground_vehicle.hpp.

Referenced by VehicleDetailsWindow::DrawWidget().

◆ cached_max_track_speed

uint16_t GroundVehicleCache::cached_max_track_speed

Maximum consist speed (in internal units) limited by track type (valid only for the first engine).

Definition at line 38 of file ground_vehicle.hpp.

Referenced by RoadVehicle::GetCurrentMaxSpeed(), and Train::GetCurrentMaxSpeed().

◆ cached_power

uint32_t GroundVehicleCache::cached_power

Total power of the consist (valid only for the first engine).

Definition at line 39 of file ground_vehicle.hpp.

Referenced by CheckTrainStayInDepot(), VehicleDetailsWindow::DrawWidget(), Vehicle::GetDisplayMinPowerToWeight(), and Train::UpdateAcceleration().

◆ cached_slope_resistance

uint32_t GroundVehicleCache::cached_slope_resistance

Resistance caused by weight when this vehicle part is at a slope.

Definition at line 33 of file ground_vehicle.hpp.

◆ cached_total_length

uint16_t GroundVehicleCache::cached_total_length

◆ cached_veh_length

uint8_t GroundVehicleCache::cached_veh_length

◆ cached_weight

uint32_t GroundVehicleCache::cached_weight

Total weight of the consist (valid only for the first engine).

Definition at line 32 of file ground_vehicle.hpp.

Referenced by VehicleDetailsWindow::DrawWidget(), and Train::UpdateAcceleration().

◆ first_engine

EngineID GroundVehicleCache::first_engine

◆ last_speed

uint16_t GroundVehicleCache::last_speed

The last speed we did display, so we only have to redraw when this changes.

Definition at line 48 of file ground_vehicle.hpp.

Referenced by AfterLoadVehiclesPhase2(), RoadVehicle::GetDisplaySpeed(), Train::GetDisplaySpeed(), and GroundVehicle< T, Type >::SetLastSpeed().


The documentation for this struct was generated from the following file: