61int GetAircraftFlightLevel(T *v,
bool takeoff =
false);
107 bool Tick()
override;
110 uint
Crash(
bool flooded =
false)
override;
142void HandleMissingAircraftOrders(
Aircraft *v);
AirVehicleFlags
Flags for air vehicles; shared with disaster vehicles.
@ VAF_HELI_DIRECT_DESCENT
The helicopter is descending directly at its destination (helipad or in front of hangar)
@ VAF_DEST_TOO_FAR
Next destination is too far away.
@ VAF_IN_MIN_HEIGHT_CORRECTION
The vehicle is currently raising its altitude because it hit the lower bound.
@ VAF_IN_MAX_HEIGHT_CORRECTION
The vehicle is currently lowering its altitude because it hit the upper bound.
void GetAircraftFlightLevelBounds(const Vehicle *v, int *min, int *max)
Get the 'flight level' bounds, in pixels from 'z_pos' 0 for a particular vehicle for normal flight si...
static constexpr int AIRCRAFT_MIN_FLYING_ALTITUDE
Base values for flight levels above ground level for 'normal' flight and holding patterns.
static constexpr int HELICOPTER_HOLD_MAX_FLYING_ALTITUDE
holding flying altitude above tile of helicopters.
static const int ROTOR_Z_OFFSET
Z Offset between helicopter- and rotorsprite.
static constexpr int PLANE_HOLD_MAX_FLYING_ALTITUDE
holding flying altitude above tile of planes.
void UpdateAirplanesOnNewStation(const Station *st)
Updates the status of the Aircraft heading or in the station.
void AircraftNextAirportPos_and_Order(Aircraft *v)
set the right pos when heading to other airports after takeoff
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
Get the size of the sprite of an aircraft sprite heading west (used for lists).
Station * GetTargetAirportIfValid(const Aircraft *v)
Returns aircraft's target station if v->target_airport is a valid station with airport.
void AircraftLeaveHangar(Aircraft *v, Direction exit_dir)
Aircraft is about to leave the hangar.
void SetAircraftPosition(Aircraft *v, int x, int y, int z)
Set aircraft position.
AircraftSubType
An aircraft can be one of those types.
@ AIR_AIRCRAFT
an airplane
@ AIR_ROTOR
rotor of an helicopter
@ AIR_SHADOW
shadow of the aircraft
@ AIR_HELICOPTER
an helicopter
void HandleAircraftEnterHangar(Aircraft *v)
Handle Aircraft specific tasks when an Aircraft enters a hangar.
static constexpr int AIRCRAFT_MAX_FLYING_ALTITUDE
Maximum flying altitude above tile.
void UpdateAircraftCache(Aircraft *v, bool update_range=false)
Update cached values of an aircraft.
Direction
Defines the 8 directions on the map.
ExpensesType
Types of expenses.
@ EXPENSES_AIRCRAFT_REVENUE
Revenue from aircraft.
@ EXPENSES_AIRCRAFT_RUN
Running costs aircraft.
uint16_t EngineID
Unique identification number of an engine.
Maps accessors for stations.
bool IsHangarTile(Tile t)
Is tile t an hangar tile?
Variables that are cached to improve performance and such.
uint32_t cached_max_range_sqr
Cached squared maximum range.
uint16_t cached_max_range
Cached maximum range.
Aircraft, helicopters, rotors and their shadows belong to this class.
bool Tick() override
Calls the tick handler of the vehicle.
Aircraft()
We don't want GCC to zero our struct! It already is zeroed and has an index!
uint8_t pos
Next desired position of the aircraft.
uint8_t state
State of the airport.
int GetDisplayMaxSpeed() const override
Gets the maximum speed in km-ish/h that can be sent into SetDParam for string processing.
uint8_t flags
Aircraft flags.
Money GetRunningCost() const override
Gets the running cost of a vehicle.
virtual ~Aircraft()
We want to 'destruct' the right class.
void UpdateDeltaXY() override
Updates the x and y offsets and the size of the sprite used for this vehicle.
uint8_t number_consecutive_turns
Protection to prevent the aircraft of making a lot of turns in order to reach a specific point.
void OnNewEconomyDay() override
Economy day handler.
uint Crash(bool flooded=false) override
Crash the (whole) vehicle chain.
int GetCurrentMaxSpeed() const override
Calculates the maximum speed of the vehicle under its current conditions.
void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const override
Gets the sprite to show for the given direction.
void OnNewCalendarDay() override
Calendar day handler.
uint8_t turn_counter
Ticks between each turn to prevent > 45 degree turns.
ExpensesType GetExpenseType(bool income) const override
Sets the expense type associated to this vehicle type.
TileIndex GetOrderStationLocation(StationID station) override
Determine the location for the station where the vehicle goes to next.
bool IsNormalAircraft() const
Check if the aircraft type is a normal flying device; eg not a rotor or a shadow.
void MarkDirty() override
Marks the vehicles to be redrawn and updates cached variables.
bool IsPrimaryVehicle() const override
Whether this is the primary vehicle in the chain.
uint16_t GetRange() const
Get the range of this aircraft.
uint8_t previous_pos
Previous desired position of the aircraft.
int GetDisplaySpeed() const override
Gets the speed in km-ish/h that can be sent into SetDParam for string processing.
bool IsInDepot() const override
Check whether the vehicle is in the depot.
StationID targetairport
Airport to go to next.
ClosestDepot FindClosestDepot() override
Find the closest depot for this vehicle and tell us the location, DestinationID and whether we should...
uint16_t crashed_counter
Timer for handling crash animations.
Structure to return information about the closest depot location, and whether it could be found.
Class defining several overloaded accessors so we don't have to cast vehicle types that often.
Aircraft * First() const
Get the first vehicle in the chain.
uint16_t cached_max_speed
Maximum speed of the consist (minimum of the max speed of all vehicles in the consist).
Sprite sequence for a vehicle part.
Direction direction
facing
uint8_t subtype
subtype (Filled with values from AircraftSubType/DisasterSubType/EffectVehicleType/GroundVehicleSubty...
void PreDestructor()
Destroy all stuff that (still) needs the virtual functions to work properly.
VehicleCache vcache
Cache of often used vehicle values.
uint16_t cur_speed
current speed
TileIndex tile
Current tile index.
Base class for all vehicles.
@ VS_HIDDEN
Vehicle is not visible.
EngineImageType
Visualisation contexts of vehicles and engines.