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