src/aircraft.h
changeset 7986 881998b115c2
parent 7984 c539c9368e3c
child 8179 1fa8cc3fbeb8
equal deleted inserted replaced
7985:c7b966f7592e 7986:881998b115c2
    29 	assert(v->type == VEH_AIRCRAFT);
    29 	assert(v->type == VEH_AIRCRAFT);
    30 	/* To be fully correct the commented out functionality is the proper one,
    30 	/* To be fully correct the commented out functionality is the proper one,
    31 	 * but since value can only be 0 or 2, it is sufficient to only check <= 2
    31 	 * but since value can only be 0 or 2, it is sufficient to only check <= 2
    32 	 * return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
    32 	 * return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
    33 	return v->subtype <= AIR_AIRCRAFT;
    33 	return v->subtype <= AIR_AIRCRAFT;
    34 }
       
    35 
       
    36 /** Check if this aircraft is in a hangar
       
    37  * @param v vehicle to check
       
    38  * @return true if in hangar
       
    39  */
       
    40 static inline bool IsAircraftInHangar(const Vehicle *v)
       
    41 {
       
    42 	assert(v->type == VEH_AIRCRAFT);
       
    43 	return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
       
    44 }
       
    45 
       
    46 /** Check if this aircraft is in a hangar and stopped
       
    47  * @param v vehicle to check
       
    48  * @return true if in hangar and stopped
       
    49  */
       
    50 static inline bool IsAircraftInHangarStopped(const Vehicle *v)
       
    51 {
       
    52 	return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
       
    53 }
    34 }
    54 
    35 
    55 /** Checks if an aircraft is buildable at the tile in question
    36 /** Checks if an aircraft is buildable at the tile in question
    56  * @param engine The engine to test
    37  * @param engine The engine to test
    57  * @param tile The tile where the hangar is
    38  * @param tile The tile where the hangar is
   131 	bool IsPrimaryVehicle() const { return IsNormalAircraft(this); }
   112 	bool IsPrimaryVehicle() const { return IsNormalAircraft(this); }
   132 	int GetImage(Direction direction) const;
   113 	int GetImage(Direction direction) const;
   133 	int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
   114 	int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
   134 	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; }
   115 	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; }
   135 	Money GetRunningCost() const { return AircraftVehInfo(this->engine_type)->running_cost * _price.aircraft_running; }
   116 	Money GetRunningCost() const { return AircraftVehInfo(this->engine_type)->running_cost * _price.aircraft_running; }
       
   117 	bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
   136 	void Tick();
   118 	void Tick();
   137 };
   119 };
   138 
   120 
   139 #endif /* AIRCRAFT_H */
   121 #endif /* AIRCRAFT_H */