Exclusive Aircraft Access

The following routines require exclusive access to the airplane APIs. Only one plugin may have this access at a time.


XPLMPlanesAvailable_f

callback

Your airplanes available callback is called when another plugin gives up access to the multiplayer planes. Use this to wait for access to multiplayer.

typedef void (* XPLMPlanesAvailable_f)(
                         void *               inRefcon
                    );

XPLMAcquirePlanes

function

XPLMAcquirePlanes grants your plugin exclusive access to the aircraft. It returns true if you gain access, false if you do not.

inAircraft - pass in an array of pointers to strings specifying the planes you want loaded. For any plane index you do not want loaded, pass a 0-length string. Other strings should be full paths with the .acf extension. NULL terminates this array, or pass NULL if there are no planes you want loaded.

Aircraft paths for this API are full, not relative aircraft paths.

If you pass in a callback and do not receive access to the planes your callback will be called when the airplanes are available. If you do receive airplane access, your callback will not be called.

XPLM_API int        XPLMAcquirePlanes(
                         char const* *        inAircraft,    /* Can be NULL */
                         XPLMPlanesAvailable_f inCallback,    /* Can be NULL */
                         void *               inRefcon
                    );

XPLMReleasePlanes

function

Call this function to release access to the planes. Note that if you are disabled, access to planes is released for you and you must reacquire it.

XPLM_API void       XPLMReleasePlanes(void);

XPLMSetActiveAircraftCount

function

This routine sets the number of active planes. If you pass in a number higher than the total number of planes availables, only the total number of planes available is actually used.

XPLM_API void       XPLMSetActiveAircraftCount(
                         int                  inCount
                    );

XPLMSetAircraftModel

function

This routine loads an aircraft model. It may only be called if you have exclusive access to the airplane APIs. Pass in the path of the model with the .acf extension. The index is zero based, but you may not pass in 0 (use XPLMSetUsersAircraft to load the user's aircracft).

This API takes a full aircraft path.

XPLM_API void       XPLMSetAircraftModel(
                         int                  inIndex,
                         const char *         inAircraftPath
                    );

XPLMDisableAIForPlane

function

This routine turns off X-Plane's AI for a given plane. The plane will continue to draw and be a real plane in X-Plane, but will not move itself.

XPLM_API void       XPLMDisableAIForPlane(
                         int                  inPlaneIndex
                    );

XPLMDrawAircraft

function XPLM_DEPRECATED

WARNING: Aircraft drawing via this API is deprecated and WILL NOT WORK in future versions of X-Plane. Use XPLMInstance for 3-d drawing of custom aircraft models.

This routine draws an aircraft. It can only be called from a 3-d drawing callback. Pass in the position of the plane in OpenGL local coordinates and the orientation of the plane. True for full drawing indicates that the whole plane must be drawn; false indicates you only need the nav lights drawn. (This saves rendering time when planes are far away.)

XPLM_API void       XPLMDrawAircraft(
                         int                  inPlaneIndex,
                         float                inX,
                         float                inY,
                         float                inZ,
                         float                inPitch,
                         float                inRoll,
                         float                inYaw,
                         int                  inFullDraw,
                         XPLMPlaneDrawState_t * inDrawStateInfo
                    );

XPLMReinitUsersPlane

function XPLM_DEPRECATED

WARNING: DO NOT USE. Use XPLMPlaceUserAtAirport or XPLMPlaceUserAtLocation.

This function recomputes the derived flight model data from the aircraft structure in memory. If you have used the data access layer to modify the aircraft structure, use this routine to resynchronize X-Plane; since X-Plane works at least partly from derived values, the sim will not behave properly until this is called.

WARNING: this routine does not necessarily place the airplane at the airport; use XPLMSetUsersAircraft to be compatible. This routine is provided to do special experimentation with flight models without resetting flight.

XPLM_API void       XPLMReinitUsersPlane(void);