src/aircraft.h
branchgamebalance
changeset 9911 0b8b245a2391
parent 9910 0b2aebc8283e
child 9912 1ac8aac92385
equal deleted inserted replaced
9910:0b2aebc8283e 9911:0b8b245a2391
   113  * Currently caches callback 36 max speed.
   113  * Currently caches callback 36 max speed.
   114  * @param v Vehicle
   114  * @param v Vehicle
   115  */
   115  */
   116 void UpdateAircraftCache(Vehicle *v);
   116 void UpdateAircraftCache(Vehicle *v);
   117 
   117 
       
   118 /**
       
   119  * This class 'wraps' Vehicle; you do not actually instantiate this class.
       
   120  * You create a Vehicle using AllocateVehicle, so it is added to the pool
       
   121  * and you reinitialize that to a Train using:
       
   122  *   v = new (v) Aircraft();
       
   123  *
       
   124  * As side-effect the vehicle type is set correctly.
       
   125  */
       
   126 struct Aircraft : public Vehicle {
       
   127 	/** Initializes the Vehicle to an aircraft */
       
   128 	Aircraft() { this->type = VEH_AIRCRAFT; }
       
   129 
       
   130 	/** We want to 'destruct' the right class. */
       
   131 	virtual ~Aircraft() {}
       
   132 
       
   133 	const char *GetTypeString() const { return "aircraft"; }
       
   134 	void MarkDirty();
       
   135 	void UpdateDeltaXY(Direction direction);
       
   136 	ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
       
   137 	WindowClass GetVehicleListWindowClass() const { return WC_AIRCRAFT_LIST; }
       
   138 };
       
   139 
   118 #endif /* AIRCRAFT_H */
   140 #endif /* AIRCRAFT_H */