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. | |
const char * | GetTypeString () const |
Get a string 'representation' of the vehicle type. | |
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. | |
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 | |
AircraftCache | acache |
Cache of often used calculated values. | |
uint16 | crashed_counter |
byte | pos |
byte | previous_pos |
StationID | targetairport |
byte | state |
DirectionByte | last_direction |
byte | number_consecutive_turns |
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 66 of file aircraft.h.
virtual Aircraft::~Aircraft | ( | ) | [inline, virtual] |
We want to 'destruct' the right class.
Definition at line 83 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 1240 of file aircraft_cmd.cpp.
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 423 of file aircraft_cmd.cpp.
References FindNearestHangar(), SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::Get(), GetTargetAirportIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, AirportSpec::nof_depots, 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 92 of file aircraft.h.
References Vehicle::max_speed.
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 91 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 88 of file aircraft.h.
References EXPENSES_AIRCRAFT_INC, and EXPENSES_AIRCRAFT_RUN.
Gets the sprite to show for the given direction.
direction | the direction the vehicle is facing |
Reimplemented from Vehicle.
Definition at line 160 of file aircraft_cmd.cpp.
References SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::Get().
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 1222 of file aircraft_cmd.cpp.
References AircraftNextAirportPos_and_Order().
Money Aircraft::GetRunningCost | ( | ) | const [virtual] |
Gets the running cost of a vehicle.
Reimplemented from Vehicle.
Definition at line 531 of file aircraft_cmd.cpp.
References SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::Get(), GetPrice(), and PROP_AIRCRAFT_RUNNING_COST_FACTOR.
Referenced by OnNewDay().
const char* Aircraft::GetTypeString | ( | ) | const [inline, virtual] |
Get a string 'representation' of the vehicle type.
Reimplemented from Vehicle.
Definition at line 85 of file aircraft.h.
bool Aircraft::IsInDepot | ( | ) | const [inline, virtual] |
Check whether the vehicle is in the depot.
Reimplemented from Vehicle.
Definition at line 94 of file aircraft.h.
References IsHangarTile(), Vehicle::tile, and Vehicle::vehstatus.
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 107 of file aircraft.h.
References AIR_AIRCRAFT, and Vehicle::subtype.
Referenced by CalculateCompanyValue(), Vehicle::IsEngineCountable(), IsPrimaryVehicle(), LoadUnloadVehicle(), 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 1233 of file aircraft_cmd.cpp.
References AIR_HELICOPTER, SpecializedVehicle< T, Type >::Next(), SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::Next(), Vehicle::subtype, and Vehicle::UpdateViewport().
bool Aircraft::Tick | ( | ) | [virtual] |
Calls the tick handler of the vehicle.
Reimplemented from Vehicle.
Definition at line 1936 of file aircraft_cmd.cpp.
References AIR_HELICOPTER, Vehicle::current_order_time, IsNormalAircraft(), Vehicle::running_ticks, Vehicle::subtype, and Vehicle::vehstatus.
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 43 of file aircraft_cmd.cpp.
References AIR_AIRCRAFT, AIR_HELICOPTER, AIR_ROTOR, AIR_SHADOW, GB(), and Vehicle::subtype.
Referenced by CmdBuildAircraft().
Ticks between each turn to prevent > 45 degree turns.
Definition at line 78 of file aircraft.h.
Referenced by AircraftController().