OpenTTD Source: ShipVehicleInfo Struct Reference

OpenTTD Source 15.3

Public Member Functions | Data Fields
ShipVehicleInfo Struct Reference

Information about a ship vehicle. More...

`#include <engine_type.h>`

## Public Member Functions
uint | ApplyWaterClassSpeedFrac (uint raw_speed, bool is_ocean) const
| Apply ocean/canal speed fraction to a velocity.

## Data Fields
uint8_t | image_index = 0
uint8_t | cost_factor = 0
uint8_t | running_cost = 0
uint8_t | acceleration = 1
| Acceleration (1 unit = 1/3.2 mph per tick = 0.5 km-ish/h per tick)
uint16_t | max_speed = 0
| Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
uint16_t | capacity = 0
SoundID | sfx {}
bool | old_refittable = 0
| Is ship refittable; only used during initialisation. Later use EngineInfo::refit_mask.
uint8_t | visual_effect = VE_DEFAULT
| Bitstuffed NewGRF visual effect data.
uint8_t | ocean_speed_frac = 0
| Fraction of maximum speed for ocean tiles.
uint8_t | canal_speed_frac = 0
| Fraction of maximum speed for canal/river tiles.

## Detailed Description

Information about a ship vehicle.

Definition at line 99 of file engine_type.h.

## Member Function Documentation

## ◆ ApplyWaterClassSpeedFrac()

uint ShipVehicleInfo::ApplyWaterClassSpeedFrac | ( | uint | raw_speed,
|  | bool | is_ocean
| ) |  | const
| inline

Apply ocean/canal speed fraction to a velocity.

Definition at line 113 of file engine_type.h.

References canal_speed_frac, and ocean_speed_frac.

Referenced by CYapfCostShipT< Types >::PfCalcCost(), and Ship::UpdateCache().

## Field Documentation

## ◆ acceleration

uint8_t ShipVehicleInfo::acceleration = 1

Acceleration (1 unit = 1/3.2 mph per tick = 0.5 km-ish/h per tick)

Definition at line 103 of file engine_type.h.

Referenced by AfterLoadGame(), CmdBuildShip(), and ShipVehicleChangeInfo().

## ◆ canal_speed_frac

uint8_t ShipVehicleInfo::canal_speed_frac = 0

Fraction of maximum speed for canal/river tiles.

Definition at line 110 of file engine_type.h.

Referenced by ApplyWaterClassSpeedFrac(), CYapfCostShipT< Types >::PfCalcCost(), and ShipVehicleChangeInfo().

## ◆ capacity

uint16_t ShipVehicleInfo::capacity = 0

Definition at line 105 of file engine_type.h.

## ◆ cost_factor

uint8_t ShipVehicleInfo::cost_factor = 0

Definition at line 101 of file engine_type.h.

## ◆ image_index

uint8_t ShipVehicleInfo::image_index = 0

Definition at line 100 of file engine_type.h.

## ◆ max_speed

uint16_t ShipVehicleInfo::max_speed = 0

Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)

Definition at line 104 of file engine_type.h.

Referenced by CYapfCostShipT< Types >::PfCalcCost(), ShipVehicleChangeInfo(), and Ship::UpdateCache().

## ◆ ocean_speed_frac

uint8_t ShipVehicleInfo::ocean_speed_frac = 0

Fraction of maximum speed for ocean tiles.

Definition at line 109 of file engine_type.h.

Referenced by ApplyWaterClassSpeedFrac(), CYapfCostShipT< Types >::PfCalcCost(), and ShipVehicleChangeInfo().

## ◆ old_refittable

bool ShipVehicleInfo::old_refittable = 0

Is ship refittable; only used during initialisation. Later use EngineInfo::refit_mask.

Definition at line 107 of file engine_type.h.

Referenced by CalculateRefitMasks(), and ShipVehicleChangeInfo().

## ◆ running_cost

uint8_t ShipVehicleInfo::running_cost = 0

Definition at line 102 of file engine_type.h.

## ◆ sfx

SoundID ShipVehicleInfo::sfx {}

Definition at line 106 of file engine_type.h.

## ◆ visual_effect

uint8_t ShipVehicleInfo::visual_effect = VE_DEFAULT

Bitstuffed NewGRF visual effect data.

Definition at line 108 of file engine_type.h.

Referenced by ShipVehicleChangeInfo().

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

- src/engine_type.h