aircraft.h
Go to the documentation of this file.00001
00002
00005 #ifndef AIRCRAFT_H
00006 #define AIRCRAFT_H
00007
00008 #include "station_map.h"
00009 #include "vehicle_base.h"
00010 #include "engine.h"
00011
00013 enum AircraftSubType {
00014 AIR_HELICOPTER = 0,
00015 AIR_AIRCRAFT = 2,
00016 AIR_SHADOW = 4,
00017 AIR_ROTOR = 6
00018 };
00019
00020
00026 static inline bool IsNormalAircraft(const Vehicle *v)
00027 {
00028 assert(v->type == VEH_AIRCRAFT);
00029
00030
00031
00032 return v->subtype <= AIR_AIRCRAFT;
00033 }
00034
00040 static inline bool CanAircraftUseStation(EngineID engine, const Station *st)
00041 {
00042 const AirportFTAClass *apc = st->Airport();
00043 const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
00044
00045 return (apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS)) != 0;
00046 }
00047
00053 static inline bool CanAircraftUseStation(EngineID engine, TileIndex tile)
00054 {
00055 return CanAircraftUseStation(engine, GetStationByTile(tile));
00056 }
00057
00065 uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi);
00066
00074 void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
00075
00079 void HandleAircraftEnterHangar(Vehicle *v);
00080
00086 void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);
00087
00092 void UpdateAirplanesOnNewStation(const Station *st);
00093
00098 void UpdateAircraftCache(Vehicle *v);
00099
00108 struct Aircraft : public Vehicle {
00110 Aircraft() { this->type = VEH_AIRCRAFT; }
00111
00113 virtual ~Aircraft() { this->PreDestructor(); }
00114
00115 const char *GetTypeString() const { return "aircraft"; }
00116 void MarkDirty();
00117 void UpdateDeltaXY(Direction direction);
00118 ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
00119 WindowClass GetVehicleListWindowClass() const { return WC_AIRCRAFT_LIST; }
00120 bool IsPrimaryVehicle() const { return IsNormalAircraft(this); }
00121 int GetImage(Direction direction) const;
00122 int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
00123 int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; }
00124 Money GetRunningCost() const { return AircraftVehInfo(this->engine_type)->running_cost * _price.aircraft_running; }
00125 bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
00126 void Tick();
00127 void OnNewDay();
00128 };
00129
00130 Station *GetTargetAirportIfValid(const Vehicle *v);
00131
00132 #endif