Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef AIRCRAFT_H
00013 #define AIRCRAFT_H
00014
00015 #include "station_map.h"
00016 #include "vehicle_base.h"
00017
00018 struct Aircraft;
00019
00021 enum AircraftSubType {
00022 AIR_HELICOPTER = 0,
00023 AIR_AIRCRAFT = 2,
00024 AIR_SHADOW = 4,
00025 AIR_ROTOR = 6
00026 };
00027
00028
00029 void HandleAircraftEnterHangar(Aircraft *v);
00030 void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, EngineImageType image_type);
00031 void UpdateAirplanesOnNewStation(const Station *st);
00032 void UpdateAircraftCache(Aircraft *v);
00033
00034 void AircraftLeaveHangar(Aircraft *v, Direction exit_dir);
00035 void AircraftNextAirportPos_and_Order(Aircraft *v);
00036 void SetAircraftPosition(Aircraft *v, int x, int y, int z);
00037 int GetAircraftFlyingAltitude(const Aircraft *v);
00038
00042 struct Aircraft : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
00043 uint16 crashed_counter;
00044 byte pos;
00045 byte previous_pos;
00046 StationID targetairport;
00047 byte state;
00048 DirectionByte last_direction;
00049 byte number_consecutive_turns;
00050 byte turn_counter;
00051
00053 Aircraft() : SpecializedVehicleBase() {}
00055 virtual ~Aircraft() { this->PreDestructor(); }
00056
00057 void MarkDirty();
00058 void UpdateDeltaXY(Direction direction);
00059 ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
00060 bool IsPrimaryVehicle() const { return this->IsNormalAircraft(); }
00061 SpriteID GetImage(Direction direction, EngineImageType image_type) const;
00062 int GetDisplaySpeed() const { return this->cur_speed; }
00063 int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed; }
00064 int GetSpeedOldUnits() const { return this->vcache.cached_max_speed * 10 / 128; }
00065 Money GetRunningCost() const;
00066 bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
00067 bool Tick();
00068 void OnNewDay();
00069 uint Crash(bool flooded = false);
00070 TileIndex GetOrderStationLocation(StationID station);
00071 bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
00072
00079 FORCEINLINE bool IsNormalAircraft() const
00080 {
00081
00082
00083
00084 return this->subtype <= AIR_AIRCRAFT;
00085 }
00086 };
00087
00091 #define FOR_ALL_AIRCRAFT(var) FOR_ALL_VEHICLES_OF_TYPE(Aircraft, var)
00092
00093 SpriteID GetRotorImage(const Aircraft *v, EngineImageType image_type);
00094
00095 Station *GetTargetAirportIfValid(const Aircraft *v);
00096
00097 #endif