Files @ r6250:8f26e7e58ba0
Branch filter:

Location: cpp/openttd-patchpack/source/src/aircraft.h

miham
(svn r9054) -Update: WebTranslator2 update to 2007-03-07 18:39:14
catalan - 2 fixed by arnaullv (2)
croatian - 95 fixed, 34 changed by Ydobon (129)
czech - 1 fixed, 3 deleted, 109 changed by Hadez (113)
danish - 4 fixed by ThomasA (4)
dutch - 2 fixed by habell (2)
esperanto - 5 fixed by LaPingvino (5)
french - 2 fixed by glx (2)
german - 1 fixed by Neonox (1)
hungarian - 1 fixed by miham (1)
italian - 1 fixed by sidew (1)
japanese - 14 fixed by ickoonite (14)
korean - 9 fixed by Nios (9)
norwegian_nynorsk - 1 fixed by Eikje3 (1)
polish - 2 fixed by meush (2)
simplified_chinese - 5 fixed by Fishingsnow (5)
slovenian - 1 fixed by Necrolyte (1)
spanish - 5 fixed by eusebio (5)
swedish - 5 fixed by daishan (5)
traditional_chinese - 7 fixed by sam0737 (7)
ukrainian - 1 fixed by znikoz (1)
/* $Id$ */

/** @file aircraft.h */

#ifndef AIRCRAFT_H
#define AIRCRAFT_H

#include "station_map.h"
#include "vehicle.h"

enum AircraftSubType {
	AIR_HELICOPTER = 0,
	AIR_AIRCRAFT   = 2,
	AIR_SHADOW     = 4,
	AIR_ROTOR      = 6
};


/** Check if the aircraft type is a normal flying device; eg
 * not a rotor or a shadow
 * @param v vehicle to check
 * @return Returns true if the aircraft is a helicopter/airplane and
 * false if it is a shadow or a rotor) */
static inline bool IsNormalAircraft(const Vehicle *v)
{
	assert(v->type == VEH_Aircraft);
	/* To be fully correct the commented out functionality is the proper one,
	 * but since value can only be 0 or 2, it is sufficient to only check <= 2
	 * return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
	return v->subtype <= AIR_AIRCRAFT;
}


static inline bool IsAircraftInHangar(const Vehicle* v)
{
	assert(v->type == VEH_Aircraft);
	return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
}

static inline bool IsAircraftInHangarStopped(const Vehicle* v)
{
	return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
}

/** Checks if an aircraft is buildable at the tile in question
 * @param engine The engine to test
 * @param tile The tile where the hangar is
 * @return true if the aircraft can be build
 */
static inline bool IsAircraftBuildableAtStation(EngineID engine, TileIndex tile)
{
	const Station *st = GetStationByTile(tile);
	const AirportFTAClass *apc = st->Airport();
	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);

	return (apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS)) != 0;
}

uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo*);

void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
void HandleAircraftEnterHangar(Vehicle *v);
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);

void UpdateAirplanesOnNewStation(const Station *st);

#endif /* AIRCRAFT_H */