aircraft.h

Go to the documentation of this file.
00001 /* $Id: aircraft.h 15308 2009-02-01 17:14:39Z frosch $ */
00002 
00005 #ifndef AIRCRAFT_H
00006 #define AIRCRAFT_H
00007 
00008 #include "station_map.h"
00009 #include "station_base.h"
00010 #include "vehicle_base.h"
00011 #include "engine_func.h"
00012 #include "engine_base.h"
00013 
00015 enum AircraftSubType {
00016   AIR_HELICOPTER = 0, 
00017   AIR_AIRCRAFT   = 2, 
00018   AIR_SHADOW     = 4, 
00019   AIR_ROTOR      = 6  
00020 };
00021 
00022 
00028 static inline bool IsNormalAircraft(const Vehicle *v)
00029 {
00030   assert(v->type == VEH_AIRCRAFT);
00031   /* To be fully correct the commented out functionality is the proper one,
00032    * but since value can only be 0 or 2, it is sufficient to only check <= 2
00033    * return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
00034   return v->subtype <= AIR_AIRCRAFT;
00035 }
00036 
00044 uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi);
00045 
00053 void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
00054 
00058 void HandleAircraftEnterHangar(Vehicle *v);
00059 
00065 void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);
00066 
00071 void UpdateAirplanesOnNewStation(const Station *st);
00072 
00077 void UpdateAircraftCache(Vehicle *v);
00078 
00079 void AircraftLeaveHangar(Vehicle *v);
00080 void AircraftNextAirportPos_and_Order(Vehicle *v);
00081 void SetAircraftPosition(Vehicle *v, int x, int y, int z);
00082 byte GetAircraftFlyingAltitude(const Vehicle *v);
00083 
00092 struct Aircraft : public Vehicle {
00094   Aircraft() { this->type = VEH_AIRCRAFT; }
00095 
00097   virtual ~Aircraft() { this->PreDestructor(); }
00098 
00099   const char *GetTypeString() const { return "aircraft"; }
00100   void MarkDirty();
00101   void UpdateDeltaXY(Direction direction);
00102   ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
00103   bool IsPrimaryVehicle() const { return IsNormalAircraft(this); }
00104   SpriteID GetImage(Direction direction) const;
00105   int GetDisplaySpeed() const { return this->cur_speed; }
00106   int GetDisplayMaxSpeed() const { return this->max_speed; }
00107   Money GetRunningCost() const;
00108   bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
00109   void Tick();
00110   void OnNewDay();
00111   TileIndex GetOrderStationLocation(StationID station);
00112   bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
00113 };
00114 
00115 Station *GetTargetAirportIfValid(const Vehicle *v);
00116 
00117 #endif /* AIRCRAFT_H */

Generated on Thu Sep 24 19:35:00 2009 for OpenTTD by  doxygen 1.5.6