Aircraft, helicopters, rotors and their shadows belong to this class. More...
#include <aircraft.h>
Public Member Functions | |
Aircraft () | |
We don't want GCC to zero our struct! It already is zeroed and has an index! | |
virtual | ~Aircraft () |
We want to 'destruct' the right class. | |
void | MarkDirty () |
Marks the vehicles to be redrawn and updates cached variables. | |
void | UpdateDeltaXY (Direction direction) |
Updates the x and y offsets and the size of the sprite used for this vehicle. | |
ExpensesType | GetExpenseType (bool income) const |
Sets the expense type associated to this vehicle type. | |
bool | IsPrimaryVehicle () const |
Whether this is the primary vehicle in the chain. | |
SpriteID | GetImage (Direction direction) const |
Gets the sprite to show for the given direction. | |
int | GetDisplaySpeed () const |
Gets the speed in km-ish/h that can be sent into SetDParam for string processing. | |
int | GetDisplayMaxSpeed () const |
Gets the maximum speed in km-ish/h that can be sent into SetDParam for string processing. | |
int | GetSpeedOldUnits () const |
Money | GetRunningCost () const |
Gets the running cost of a vehicle. | |
bool | IsInDepot () const |
Check whether the vehicle is in the depot. | |
bool | Tick () |
Calls the tick handler of the vehicle. | |
void | OnNewDay () |
Calls the new day handler of the vehicle. | |
uint | Crash (bool flooded=false) |
Crash the (whole) vehicle chain. | |
TileIndex | GetOrderStationLocation (StationID station) |
Determine the location for the station where the vehicle goes to next. | |
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 reverse. | |
FORCEINLINE bool | IsNormalAircraft () const |
Check if the aircraft type is a normal flying device; eg not a rotor or a shadow. | |
Data Fields | |
uint16 | crashed_counter |
Timer for handling crash animations. | |
byte | pos |
Next desired position of the aircraft. | |
byte | previous_pos |
Previous desired position of the aircraft. | |
StationID | targetairport |
Airport to go to next. | |
byte | state |
State of the airport. | |
DirectionByte | last_direction |
byte | number_consecutive_turns |
Protection to prevent the aircraft of making a lot of turns in order to reach a specific point. | |
byte | turn_counter |
Ticks between each turn to prevent > 45 degree turns. |
Aircraft, helicopters, rotors and their shadows belong to this class.
Definition at line 42 of file aircraft.h.
virtual Aircraft::~Aircraft | ( | ) | [inline, virtual] |
We want to 'destruct' the right class.
Definition at line 55 of file aircraft.h.
References Vehicle::PreDestructor().
uint Aircraft::Crash | ( | bool | flooded = false |
) | [virtual] |
Crash the (whole) vehicle chain.
flooded | whether the cause of the crash is flooding or not. |
Reimplemented from Vehicle.
Definition at line 1118 of file aircraft_cmd.cpp.
References crashed_counter.
Referenced by CrashAirplane().
bool Aircraft::FindClosestDepot | ( | TileIndex * | location, | |
DestinationID * | destination, | |||
bool * | reverse | |||
) | [virtual] |
Find the closest depot for this vehicle and tell us the location, DestinationID and whether we should reverse.
location | where do we go to? | |
destination | what hangar do we go to? | |
reverse | should the vehicle be reversed? |
Reimplemented from Vehicle.
Definition at line 345 of file aircraft_cmd.cpp.
References Station::airport, FindNearestHangar(), SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::Get(), GetTargetAirportIfValid(), Airport::HasHangar(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, and BaseStation::xy.
int Aircraft::GetDisplayMaxSpeed | ( | ) | const [inline, virtual] |
Gets the maximum speed in km-ish/h that can be sent into SetDParam for string processing.
Reimplemented from Vehicle.
Definition at line 63 of file aircraft.h.
References VehicleCache::cached_max_speed, and Vehicle::vcache.
int Aircraft::GetDisplaySpeed | ( | ) | const [inline, virtual] |
Gets the speed in km-ish/h that can be sent into SetDParam for string processing.
Reimplemented from Vehicle.
Definition at line 62 of file aircraft.h.
References Vehicle::cur_speed.
ExpensesType Aircraft::GetExpenseType | ( | bool | income | ) | const [inline, virtual] |
Sets the expense type associated to this vehicle type.
income | whether this is income or (running) expenses of the vehicle |
Reimplemented from Vehicle.
Definition at line 59 of file aircraft.h.
References EXPENSES_AIRCRAFT_INC.
Gets the sprite to show for the given direction.
direction | the direction the vehicle is facing |
Reimplemented from Vehicle.
Definition at line 146 of file aircraft_cmd.cpp.
References Vehicle::engine_type, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::Get(), and Vehicle::spritenum.
Determine the location for the station where the vehicle goes to next.
Things done for example are allocating slots in a road stop or exact location of the platform is determined for ships.
station | the station to make the next location of the vehicle. |
Reimplemented from Vehicle.
Definition at line 1100 of file aircraft_cmd.cpp.
References AircraftNextAirportPos_and_Order(), FLYING, and state.
Money Aircraft::GetRunningCost | ( | ) | const [virtual] |
Gets the running cost of a vehicle.
Reimplemented from Vehicle.
Definition at line 390 of file aircraft_cmd.cpp.
References Vehicle::engine_type, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::Get(), GetPrice(), Engine::grf_prop, GRFFilePropsBase< Tcnt >::grffile, and PROP_AIRCRAFT_RUNNING_COST_FACTOR.
Referenced by OnNewDay().
bool Aircraft::IsInDepot | ( | ) | const [inline, virtual] |
Check whether the vehicle is in the depot.
Reimplemented from Vehicle.
Definition at line 66 of file aircraft.h.
References IsHangarTile(), Vehicle::tile, Vehicle::vehstatus, and VS_HIDDEN.
FORCEINLINE bool Aircraft::IsNormalAircraft | ( | ) | const [inline] |
Check if the aircraft type is a normal flying device; eg not a rotor or a shadow.
Definition at line 79 of file aircraft.h.
References Vehicle::subtype.
Referenced by AfterLoadGame(), CalculateCompanyValue(), Vehicle::IsEngineCountable(), IsPrimaryVehicle(), LoadUnloadVehicle(), NewVehicleAvailable(), OnNewDay(), RemoveAirport(), Tick(), UpdateAirplanesOnNewStation(), UpdateOldAircraft(), and Station::~Station().
void Aircraft::MarkDirty | ( | ) | [virtual] |
Marks the vehicles to be redrawn and updates cached variables.
This method marks the area of the vehicle on the screen as dirty. It can be use to repaint the vehicle.
Reimplemented from Vehicle.
Definition at line 1111 of file aircraft_cmd.cpp.
References AIR_HELICOPTER, Vehicle::cur_image, SpecializedVehicle< T, Type >::Next(), SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::Next(), Vehicle::subtype, and SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::UpdateViewport().
bool Aircraft::Tick | ( | ) | [virtual] |
Calls the tick handler of the vehicle.
Reimplemented from Vehicle.
Definition at line 1853 of file aircraft_cmd.cpp.
References AIR_HELICOPTER, Vehicle::current_order_time, IsNormalAircraft(), Vehicle::running_ticks, Vehicle::subtype, Vehicle::vehstatus, and VS_STOPPED.
void Aircraft::UpdateDeltaXY | ( | Direction | direction | ) | [virtual] |
Updates the x and y offsets and the size of the sprite used for this vehicle.
direction | the direction the vehicle is facing |
Reimplemented from Vehicle.
Definition at line 47 of file aircraft_cmd.cpp.
References AIR_AIRCRAFT, AIR_HELICOPTER, AIR_ROTOR, AIR_SHADOW, ENDTAKEOFF, FLYING, HELILANDING, LANDING, state, Vehicle::subtype, Vehicle::x_extent, Vehicle::x_offs, Vehicle::y_extent, Vehicle::y_offs, and Vehicle::z_extent.
Referenced by AircraftLandAirplane(), and CmdBuildAircraft().
byte Aircraft::state |
State of the airport.
Definition at line 47 of file aircraft.h.
Referenced by AfterLoadGame(), AircraftController(), AircraftEventHandler_AtTerminal(), AircraftEventHandler_EnterHangar(), AircraftEventHandler_InHangar(), CmdBuildAircraft(), CmdStartStopVehicle(), FreeTerminal(), GetOrderStationLocation(), MapAircraftMovementAction(), MapAircraftMovementState(), RemoveAirport(), Vehicle::SendToDepot(), UpdateAirplanesOnNewStation(), UpdateDeltaXY(), UpdateOldAircraft(), and UpdateOrderDest().