src/aircraft.h
branchgamebalance
changeset 9908 0fa543611bbe
parent 9895 7bd07f43b0e3
child 9910 0b2aebc8283e
equal deleted inserted replaced
9907:3b068c3a1c74 9908:0fa543611bbe
     6 #define AIRCRAFT_H
     6 #define AIRCRAFT_H
     7 
     7 
     8 #include "station_map.h"
     8 #include "station_map.h"
     9 #include "vehicle.h"
     9 #include "vehicle.h"
    10 
    10 
       
    11 /** An aircraft can be one ot those types */
    11 enum AircraftSubType {
    12 enum AircraftSubType {
    12 	AIR_HELICOPTER = 0,
    13 	AIR_HELICOPTER = 0, ///< an helicopter
    13 	AIR_AIRCRAFT   = 2,
    14 	AIR_AIRCRAFT   = 2, ///< an airplane
    14 	AIR_SHADOW     = 4,
    15 	AIR_SHADOW     = 4, ///< shadow of the aircraft
    15 	AIR_ROTOR      = 6
    16 	AIR_ROTOR      = 6  ///< rotor of an helicopter
    16 };
    17 };
    17 
    18 
    18 
    19 
    19 /** Check if the aircraft type is a normal flying device; eg
    20 /** Check if the aircraft type is a normal flying device; eg
    20  * not a rotor or a shadow
    21  * not a rotor or a shadow
    28 	 * but since value can only be 0 or 2, it is sufficient to only check <= 2
    29 	 * but since value can only be 0 or 2, it is sufficient to only check <= 2
    29 	 * return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
    30 	 * return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
    30 	return v->subtype <= AIR_AIRCRAFT;
    31 	return v->subtype <= AIR_AIRCRAFT;
    31 }
    32 }
    32 
    33 
    33 
    34 /** Check if this aircraft is in a hangar
       
    35  * @param v vehicle to check
       
    36  * @return true if in hangar
       
    37  */
    34 static inline bool IsAircraftInHangar(const Vehicle* v)
    38 static inline bool IsAircraftInHangar(const Vehicle* v)
    35 {
    39 {
    36 	assert(v->type == VEH_AIRCRAFT);
    40 	assert(v->type == VEH_AIRCRAFT);
    37 	return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
    41 	return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
    38 }
    42 }
    39 
    43 
       
    44 /** Check if this aircraft is in a hangar and stopped
       
    45  * @param v vehicle to check
       
    46  * @return true if in hangar and stopped
       
    47  */
    40 static inline bool IsAircraftInHangarStopped(const Vehicle* v)
    48 static inline bool IsAircraftInHangarStopped(const Vehicle* v)
    41 {
    49 {
    42 	return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
    50 	return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
    43 }
    51 }
    44 
    52 
    54 	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
    62 	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
    55 
    63 
    56 	return (apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS)) != 0;
    64 	return (apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS)) != 0;
    57 }
    65 }
    58 
    66 
    59 uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo*);
    67 /**
       
    68  * Calculates cargo capacity based on an aircraft's passenger
       
    69  * and mail capacities.
       
    70  * @param cid Which cargo type to calculate a capacity for.
       
    71  * @param avi Which engine to find a cargo capacity for.
       
    72  * @return New cargo capacity value.
       
    73  */
       
    74 uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi);
    60 
    75 
       
    76 /**
       
    77  * This is the Callback method after the construction attempt of an aircraft
       
    78  * @param success indicates completion (or not) of the operation
       
    79  * @param tile of depot where aircraft is built
       
    80  * @param p1 unused
       
    81  * @param p2 unused
       
    82  */
    61 void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
    83 void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
       
    84 
       
    85 /**
       
    86  * This is the Callback method after the cloning attempt of an aircraft
       
    87  * @param success indicates completion (or not) of the operation
       
    88  * @param tile unused
       
    89  * @param p1 unused
       
    90  * @param p2 unused
       
    91  */
    62 void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
    92 void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
       
    93 
       
    94 /** Handle Aircraft specific tasks when a an Aircraft enters a hangar
       
    95  * @param *v Vehicle that enters the hangar
       
    96  */
    63 void HandleAircraftEnterHangar(Vehicle *v);
    97 void HandleAircraftEnterHangar(Vehicle *v);
       
    98 
       
    99 /** Get the size of the sprite of an aircraft sprite heading west (used for lists)
       
   100  * @param engine The engine to get the sprite from
       
   101  * @param width The width of the sprite
       
   102  * @param height The height of the sprite
       
   103  */
    64 void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);
   104 void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);
    65 
   105 
       
   106 /**
       
   107  * Updates the status of the Aircraft heading or in the station
       
   108  * @param st Station been updated
       
   109  */
    66 void UpdateAirplanesOnNewStation(const Station *st);
   110 void UpdateAirplanesOnNewStation(const Station *st);
    67 
   111 
    68 #endif /* AIRCRAFT_H */
   112 #endif /* AIRCRAFT_H */