Aircraft Struct Reference

This class 'wraps' Vehicle; you do not actually instantiate this class. More...

#include <aircraft.h>

Inheritance diagram for Aircraft:

Vehicle PoolItem< T, Tid, Tpool > BaseVehicle

Public Member Functions

 Aircraft ()
 Initializes the Vehicle to an aircraft.
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 mph that can be sent into SetDParam for string processing.
int GetDisplayMaxSpeed () const
 Gets the maximum speed in mph 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.
void Tick ()
 Calls the tick handler of the vehicle.
void OnNewDay ()
 Calls the new day handler of the vehicle.
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.

Detailed Description

This class 'wraps' Vehicle; you do not actually instantiate this class.

You create a Vehicle using AllocateVehicle, so it is added to the pool and you reinitialize that to a Train using: v = new (v) Aircraft();

As side-effect the vehicle type is set correctly.

Definition at line 110 of file aircraft.h.


Member Function Documentation

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.

Parameters:
location where do we go to?
destination what hangar do we go to?
reverse should the vehicle be reversed?
Returns:
true if a depot could be found.

Reimplemented from Vehicle.

Definition at line 499 of file aircraft_cmd.cpp.

References Station::Airport(), Station::airport_tile, FindNearestHangar(), PoolItem< T, Tid, Tpool >::index, INVALID_STATION, Station::IsValid(), AirportFTAClass::nof_depots, and Station::xy.

int Aircraft::GetDisplayMaxSpeed (  )  const [inline, virtual]

Gets the maximum speed in mph that can be sent into SetDParam for string processing.

Returns:
the vehicle's maximum speed

Reimplemented from Vehicle.

Definition at line 124 of file aircraft.h.

References Vehicle::max_speed.

int Aircraft::GetDisplaySpeed (  )  const [inline, virtual]

Gets the speed in mph that can be sent into SetDParam for string processing.

Returns:
the vehicle's speed

Reimplemented from Vehicle.

Definition at line 123 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.

Parameters:
income whether this is income or (running) expenses of the vehicle

Reimplemented from Vehicle.

Definition at line 120 of file aircraft.h.

SpriteID Aircraft::GetImage ( Direction  direction  )  const [virtual]

Gets the sprite to show for the given direction.

Parameters:
direction the direction the vehicle is facing
Returns:
the sprite for the given vehicle in the given direction

Reimplemented from Vehicle.

Definition at line 163 of file aircraft_cmd.cpp.

References _aircraft_sprite, GetCustomVehicleSprite, is_custom_sprite, and Vehicle::spritenum.

Referenced by MarkDirty().

TileIndex Aircraft::GetOrderStationLocation ( StationID  station  )  [virtual]

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.

Parameters:
station the station to make the next location of the vehicle.
Returns:
the location (tile) to aim for.

Reimplemented from Vehicle.

Definition at line 1314 of file aircraft_cmd.cpp.

References AircraftNextAirportPos_and_Order().

Money Aircraft::GetRunningCost (  )  const [inline, virtual]

Gets the running cost of a vehicle.

Returns:
the vehicle's running cost

Reimplemented from Vehicle.

Definition at line 125 of file aircraft.h.

References _price, Prices::aircraft_running, AircraftVehInfo(), and AircraftVehicleInfo::running_cost.

const char* Aircraft::GetTypeString (  )  const [inline, virtual]

Get a string 'representation' of the vehicle type.

Returns:
the string representation.

Reimplemented from Vehicle.

Definition at line 117 of file aircraft.h.

bool Aircraft::IsInDepot (  )  const [inline, virtual]

Check whether the vehicle is in the depot.

Returns:
true if and only if the vehicle is in the depot.

Reimplemented from Vehicle.

Definition at line 126 of file aircraft.h.

References IsHangarTile().

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 1325 of file aircraft_cmd.cpp.

References AIR_HELICOPTER, Vehicle::cur_image, GetImage(), GetRotorImage(), MarkSingleVehicleDirty(), and Vehicle::Next().

void Aircraft::UpdateDeltaXY ( Direction  direction  )  [virtual]

Updates the x and y offsets and the size of the sprite used for this vehicle.

Parameters:
direction the direction the vehicle is facing

Reimplemented from Vehicle.

Definition at line 44 of file aircraft_cmd.cpp.

References AIR_AIRCRAFT, AIR_HELICOPTER, AIR_ROTOR, AIR_SHADOW, GB(), NOT_REACHED, x, Vehicle::x_extent, Vehicle::x_offs, Vehicle::y_extent, Vehicle::y_offs, and Vehicle::z_extent.


The documentation for this struct was generated from the following files:
Generated on Sat Sep 6 20:15:59 2008 for openttd by  doxygen 1.4.7