XPMP2
X-Plane multiplayer library 2 - using instancing
Aircraft.cpp File Reference

XPMP2::Aircraft represents an aircraft as managed by XPMP2. More...

#include "XPMP2.h"

Namespaces

namespace  XPMP2
 

Macros

#define WARN_MODEL_NOT_FOUND   "Named CSL Model '%s' not found"
 
#define FATAL_MODE_S_OUT_OF_RGE   "_modeS_id (0x%06X) is out of range [0x%06X..0x%06X]"
 
#define FATAL_MODE_S_EXISTS   "_modeS_id (0x%06X) already exists"
 
#define FATAL_CREATE_INVALID   "Called Aircraft::Create() on already defined plane with _modeS_id (0x%06X)"
 
#define DEBUG_REPL_MODE_S   "Replaced duplicate _modeS_id 0x%06X with new unique value 0x%06X"
 
#define ERR_CREATE_INSTANCE   "Aircraft 0x%06X: Create Instance FAILED for CSL Model %s"
 
#define DEBUG_INSTANCE_CREATED   "Aircraft 0x%06X: Instance created of model %s for '%s'"
 
#define DEBUG_INSTANCE_DESTRYD   "Aircraft 0x%06X: Instance destroyed"
 
#define INFO_MODEL_CHANGE   "Aircraft 0x%06X: Changing model from %s to %s"
 
#define ERR_YPROBE   "Aircraft 0x%06X: Could not create Y-Probe for terrain testing!"
 
#define ERR_SET_INVALID   "Aircraft 0x%06X set INVALID"
 
#define WARN_PLANES_LEFT_EXIT   "Still %lu aircaft defined during shutdown! Plugin should destroy them prior to shutting down."
 
#define ERR_ADD_DATAREF_INIT   "Could not add dataRef %s, XPMP2 not yet initialized?"
 
#define ERR_ADD_DATAREF_PLANES   "Could add dataRef %s only if no aircraft are flying, but currently there are %lu aircraft."
 
#define ERR_WORKER_THREAD   "Can only be called from XP's main thread!"
 
#define DEBUG_DATAREF_ADDED   "Added dataRef %s as index %lu"
 

Typedefs

typedef std::map< std::string, Aircraft::wakeTyXPMP2::mapWakeTy
 

Functions

float XPMP2::obj_get_float (void *)
 
int XPMP2::obj_get_float_array (void *, float *, int, int inCount)
 See obj_get_float()
 
void XPMP2::AcInit ()
 Initialize the module.
 
void XPMP2::AcCleanup ()
 Grace cleanup, esp. remove all aircraft.
 
XPMP2_EXPORT AircraftXPMP2::AcFindByID (XPMPPlaneID _id)
 Find aircraft by its plane ID, can return nullptr.
 
XPMP2_EXPORT bool XPMP2::AcSetDefaultWakeData (const std::string &_wtc, const Aircraft::wakeTy &_wake)
 (Re)Define default wake turbulence values per WTC
 
size_t XPMPAddModelDataRef (const std::string &dataRef)
 

Variables

XPLMFlightLoopID XPMP2::gFlightLoopID = nullptr
 The id of our flight loop callback.
 
std::vector< std::unique_ptr< std::string > > XPMP2::drStrings
 
std::vector< XPLMDataRef > XPMP2::ahDataRefs
 Registered dataRefs.
 

Detailed Description

XPMP2::Aircraft represents an aircraft as managed by XPMP2.

Note
This class bases on and is compatible to the XPCAircraft wrapper class provided with the original libxplanemp. In XPMP2, however, this class is not a wrapper but the actual means of managing aircraft. Hence, it includes a lot more members.
Author
Birger Hoppe

Macro Definition Documentation

◆ DEBUG_DATAREF_ADDED

#define DEBUG_DATAREF_ADDED   "Added dataRef %s as index %lu"

◆ DEBUG_INSTANCE_CREATED

#define DEBUG_INSTANCE_CREATED   "Aircraft 0x%06X: Instance created of model %s for '%s'"

◆ DEBUG_INSTANCE_DESTRYD

#define DEBUG_INSTANCE_DESTRYD   "Aircraft 0x%06X: Instance destroyed"

◆ DEBUG_REPL_MODE_S

#define DEBUG_REPL_MODE_S   "Replaced duplicate _modeS_id 0x%06X with new unique value 0x%06X"

◆ ERR_ADD_DATAREF_INIT

#define ERR_ADD_DATAREF_INIT   "Could not add dataRef %s, XPMP2 not yet initialized?"

◆ ERR_ADD_DATAREF_PLANES

#define ERR_ADD_DATAREF_PLANES   "Could add dataRef %s only if no aircraft are flying, but currently there are %lu aircraft."

◆ ERR_CREATE_INSTANCE

#define ERR_CREATE_INSTANCE   "Aircraft 0x%06X: Create Instance FAILED for CSL Model %s"

◆ ERR_SET_INVALID

#define ERR_SET_INVALID   "Aircraft 0x%06X set INVALID"

◆ ERR_WORKER_THREAD

#define ERR_WORKER_THREAD   "Can only be called from XP's main thread!"

◆ ERR_YPROBE

#define ERR_YPROBE   "Aircraft 0x%06X: Could not create Y-Probe for terrain testing!"

◆ FATAL_CREATE_INVALID

#define FATAL_CREATE_INVALID   "Called Aircraft::Create() on already defined plane with _modeS_id (0x%06X)"

◆ FATAL_MODE_S_EXISTS

#define FATAL_MODE_S_EXISTS   "_modeS_id (0x%06X) already exists"

◆ FATAL_MODE_S_OUT_OF_RGE

#define FATAL_MODE_S_OUT_OF_RGE   "_modeS_id (0x%06X) is out of range [0x%06X..0x%06X]"

◆ INFO_MODEL_CHANGE

#define INFO_MODEL_CHANGE   "Aircraft 0x%06X: Changing model from %s to %s"

◆ WARN_MODEL_NOT_FOUND

#define WARN_MODEL_NOT_FOUND   "Named CSL Model '%s' not found"

◆ WARN_PLANES_LEFT_EXIT

#define WARN_PLANES_LEFT_EXIT   "Still %lu aircaft defined during shutdown! Plugin should destroy them prior to shutting down."

Function Documentation

◆ XPMPAddModelDataRef()

size_t XPMPAddModelDataRef ( const std::string & dataRef)