OpenTTD Source: GroundVehicleCache Struct Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Data Fields
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 = 0
| Total weight of the consist (valid only for the first engine).
uint32_t | cached_slope_resistance = 0
| Resistance caused by weight when this vehicle part is at a slope.
uint32_t | cached_max_te = 0
| Maximum tractive effort of consist (valid only for the first engine).
uint16_t | cached_axle_resistance = 0
| Resistance caused by the axles of the vehicle (valid only for the first engine).
uint16_t | cached_max_track_speed = 0
| Maximum consist speed (in internal units) limited by track type (valid only for the first engine).
uint32_t | cached_power = 0
| Total power of the consist (valid only for the first engine).
uint32_t | cached_air_drag = 0
| Air drag coefficient of the vehicle (valid only for the first engine).
uint16_t | cached_total_length = 0
| Length of the whole vehicle (valid only for the first engine).
EngineID | first_engine = EngineID::Invalid()
| Cached EngineID of the front vehicle. EngineID::Invalid() for the front vehicle itself.
uint8_t | cached_veh_length = 0
| 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 = 0
| 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 = 0

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 = 0

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 = 0

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 = 0

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 = 0

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(), and Train::UpdateAcceleration().

## ◆ cached_slope_resistance

uint32_t GroundVehicleCache::cached_slope_resistance = 0

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 = 0

Length of the whole vehicle (valid only for the first engine).

Definition at line 43 of file ground_vehicle.hpp.

Referenced by Train::ConsistChanged(), DepotWindow::DrawVehicleInDepot(), RoadStop::Entry::Enter(), GetTrainStopLocation(), RoadStop::Entry::Leave(), RoadVehUpdateCache(), UpdateLoadUnloadTicks(), and VehicleLengthSorter().

## ◆ cached_veh_length

uint8_t GroundVehicleCache::cached_veh_length = 0

Length of this vehicle in units of 1/VEHICLE_LENGTH of normal length. It is cached because this can be set by a callback.

Definition at line 45 of file ground_vehicle.hpp.

Referenced by AddArticulatedParts(), Train::CalcNextVehicleOffset(), CheckTrainAttachment(), CheckTrainCollision(), RoadVehicle::GetDisplayImageWidth(), Train::GetDisplayImageWidth(), GetTrainStopLocation(), TrainApproachingLineEnd(), RoadVehicle::UpdateDeltaXY(), and Train::UpdateDeltaXY().

## ◆ cached_weight

uint32_t GroundVehicleCache::cached_weight = 0

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 = EngineID::Invalid()

Cached EngineID of the front vehicle. EngineID::Invalid() for the front vehicle itself.

Definition at line 44 of file ground_vehicle.hpp.

Referenced by AddArticulatedParts(), CheckTrainAttachment(), CmdBuildRailVehicle(), CmdBuildRailWagon(), Train::GetMaxWeight(), Train::GetPoweredPartPower(), GetVehiclePalette(), Train::GetWeight(), LiveryHelper(), and VehicleResolverObject::VehicleResolverObject().

## ◆ last_speed

uint16_t GroundVehicleCache::last_speed = 0

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:

- src/ground_vehicle.hpp