XPMP2
X-Plane multiplayer library 2 - using instancing
|
All global config settings and variables are kept in one structure for convenient access and central definition. More...
#include <XPMP2.h>
Public Member Functions | |
bool | remoteAutoDiscovery () const |
Use auto-discovery for the MC send interface? More... | |
bool | RemoteIsListener () const |
Are we a listener? More... | |
bool | RemoteIsSender () const |
Are we a sender? More... | |
XPMPPlaneID | NextPlaneId () |
Get the next unique artifical plane id. More... | |
GlobVars (logLevelTy _logLvl=logINFO, bool _logMdlMatch=false) | |
Constructor. More... | |
void | ReadConfigFile () |
Read from a generic XPMP2.prf or XPMP2.<logAcronym>.prf config file. More... | |
void | UpdateCfgVals () |
Update all settings, e.g. for logging level, by calling prefsFuncInt. More... | |
void | ReadVersions () |
Read version numbers into verXplane/verXPLM. More... | |
bool | UsingModernGraphicsDriver () const |
Using a modern graphics driver, ie. Vulkan/Metal? More... | |
void | ThisThreadIsXP () |
Set current thread as main xp Thread. More... | |
bool | IsXPThread () const |
Is this thread XP's main thread? More... | |
void | UpdateCameraPos () |
Update the stored camera position and velocity values. More... | |
Public Attributes | |
logLevelTy | logLvl = logINFO |
Logging level. More... | |
bool | bLogMdlMatch = false |
Debug model matching? More... | |
bool | bClampAll = false |
Clamp all planes to the ground? Default is false as clamping is kinda expensive due to Y-Testing. More... | |
bool | bHandleDupId = false |
Handle duplicate XPMP2::Aircraft::modeS_id by overwriting with unique id. More... | |
bool | bObjReplDataRefs = false |
Replace dataRefs in .obj files on load? (defaults to OFF!) More... | |
bool | bObjReplTextures = true |
Replace textures in .obj files on load if needed? More... | |
std::string | pathObj8DataRefs |
Path to the Obj8DataRefs.txt file. More... | |
listObj8DataRefsTy | listObj8DataRefs |
List of dataRef replacement in .obj files. More... | |
std::string | pluginName = UNKNOWN_PLUGIN_NAME |
Name of the plugin we are serving (used as map layer name or for folders) More... | |
std::string | logAcronym = UNKNOWN_PLUGIN_NAME |
Plugin acronym used in log output. More... | |
int(* | prefsFuncInt )(const char *, const char *, int) = XPMP2::PrefsFuncIntDefault |
Configuration callback for integer values. More... | |
listXPMPPlaneNotifierTy | listObservers |
List of notifier functions registered for being notified of creation/destruction/model change. More... | |
std::string | pathDoc8643 |
Path to Doc8643.txt file. More... | |
mapDoc8643Ty | mapDoc8643 |
Content of Doc8643.txt file. More... | |
std::array< std::string, REL_TXT_NUM > | pathRelated = {} |
Paths to related.txt, relOp.txt... files. More... | |
std::array< mapRelatedTy, REL_TXT_NUM > | mapRelated = {} |
Content of related.txt and similar files as a map of keys to group id. More... | |
mapCSLPackageTy | mapCSLPkgs |
Global map of all CSL Packages, indexed by xsb_aircraft.txt::EXPORT_NAME More... | |
mapCSLModelTy | mapCSLModels |
Global map of all CSL Models, indexed by related group, aircraft type, and model id. More... | |
std::string | defaultICAO = "A320" |
Default ICAO aircraft type designator if no match can be found. More... | |
std::string | carIcaoType = "ZZZC" |
Ground vehicle type identifier (map decides icon based on this) More... | |
std::string | resourceDir |
Resource directory, to store local definitions of vertical offsets (clamping) More... | |
mapAcTy | mapAc |
Global map of all created planes. More... | |
bool | bDrawLabels = true |
Shall we draw aircraft labels? More... | |
ThreeWaySwitchTy | eLabelOverride = SWITCH_CFG_AUTO |
Label drawing overriden in XPMP2.prf ? More... | |
float | maxLabelDist = 5556.0f |
Maximum distance for drawing labels? [m], defaults to 3nm. More... | |
bool | bLabelCutOffAtVisibility = true |
Cut off labels at XP's reported visibility mit? More... | |
float | labelFontScaling = 1.0f |
Label font scaling factor. More... | |
bool | bHasControlOfAIAircraft = false |
Do we control X-Plane's AI/Multiplayer planes? More... | |
ThreeWaySwitchTy | eAIOverride = SWITCH_CFG_AUTO |
AI Control overriden in XPMP2.prf ? More... | |
bool | bMapEnabled = true |
Do we feed X-Plane's maps with our aircraft positions? More... | |
bool | bMapLabels = true |
Do we show labels with the aircraft icons? More... | |
mapMapLayerIDTy | mapMapLayers |
Map of map layer ids, i.e. for each map this is the id of the corresponding layer of ours. More... | |
std::string | pathMapIcons |
path to file containing plane icons for map display More... | |
std::string | remoteMCGroup = "239.255.1.1" |
The multicast group that we use, which is the same X-Plane is using itself for its BEACON. More... | |
int | remotePort = 49788 |
The port we use is different from the port the X-Plane BEACON uses, so we don't get into conflict. More... | |
std::string | remoteSendIntf |
The interface used to send multicast on. (Empty == auto-discovery) More... | |
int | remoteTTL = 8 |
Time-to-live, or mumber of hops for a multicast message. More... | |
size_t | remoteBufSize = 8192 |
Buffer size, ie. max message length we send over multicast. More... | |
int | remoteTxfFrequ = 5 |
Max transfer frequency per second. More... | |
ThreeWaySwitchTy | remoteCfg = SWITCH_CFG_AUTO |
Configuration: Are we to support remote connections? More... | |
ThreeWaySwitchTy | remoteCfgFromIni = SWITCH_CFG_AUTO |
Configuration file entry: Are we to support remote connections? More... | |
RemoteStatusTy | remoteStatus = REMOTE_OFF |
Status of remote connections to networked clients. More... | |
int | contrailAltMin_ft = 25000 |
[ft] Auto Contrails: Minimum altitude More... | |
int | contrailAltMax_ft = 45000 |
[ft] Auto Contrails: Maximum altitude More... | |
int | contrailLifeTime = 25 |
[s] Contrail default time to live More... | |
bool | contrailMulti = false |
Auto-create multiple or just a single contrail? More... | |
bool | bSoundOnStartup = true |
Config: Start Sound on startup? More... | |
bool | bSoundForceFmodInstance = false |
Config: Force own FMOD instance? More... | |
bool | bSoundMuteOnPause = true |
Config: Mute on Pause? More... | |
bool | bSoundAvail = false |
Is the sound system available? More... | |
float | sndMasterVol = 1.0f |
Sound master volume. More... | |
bool | bSoundAutoMuted = false |
Is sound currently being auto-muted? More... | |
int | verXPlane = -1 |
X-Plane's version number (XPLMGetVersions) More... | |
int | verXPLM = -1 |
XPLM's SDK version number (XPLMGetVersions) More... | |
bool | bXPUsingModernGraphicsDriver = false |
Using a modern graphics driver, ie. Vulkan/Metal? More... | |
bool | bXPNetworkedSetup = false |
Is X-Plane configured for networked multi-computer or multiplayer setup? More... | |
XPLMPluginID | pluginId = 0 |
This plugin's id. More... | |
std::thread::id | xpThread |
id of X-Plane's thread (when it is OK to use XP API calls) More... | |
XPLMCameraPosition_t | posCamera = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } |
Current camera location, updated every flight loop. More... | |
XPLMCameraPosition_t | prevCamera = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } |
Previous camera location of about a second ago. More... | |
float | vCam_x = 0.0f |
Camera velocity. More... | |
float | vCam_y = 0.0f |
float | vCam_z = 0.0f |
float | prevCamera_ts = 0.0f |
When has prevCamera been updated last? More... | |
int | xpCycleNum = 0 |
Current XP cycle number (see XPLMGetCycleNumber()) More... | |
Protected Attributes | |
XPMPPlaneID | planeId = 0 |
Current plane ID counter. More... | |
All global config settings and variables are kept in one structure for convenient access and central definition.
|
inline |
Constructor.
|
inline |
Is this thread XP's main thread?
XPMPPlaneID XPMP2::GlobVars::NextPlaneId | ( | ) |
Get the next unique artifical plane id.
void XPMP2::GlobVars::ReadConfigFile | ( | ) |
Read from a generic XPMP2.prf
or XPMP2.<logAcronym>.prf
config file.
Goal is to provide some few configuration options independend of the plugin using XPMP2. This is useful e.g. when configuring non-standard network settings for remote connections.
For even greater flexibility the function will try a plugin-specific file first, named "XPMP2.<logAcronym>.prf" (with spaces replaced with underscores) and if that is not found it tries the generic file "XPMP2.prf".
A config file is completely optional, none is required.
void XPMP2::GlobVars::ReadVersions | ( | ) |
Read version numbers into verXplane/verXPLM.
|
inline |
Use auto-discovery for the MC send interface?
|
inline |
Are we a listener?
|
inline |
Are we a sender?
|
inline |
Set current thread as main xp Thread.
void XPMP2::GlobVars::UpdateCameraPos | ( | ) |
Update the stored camera position and velocity values.
void XPMP2::GlobVars::UpdateCfgVals | ( | ) |
Update all settings, e.g. for logging level, by calling prefsFuncInt.
|
inline |
Using a modern graphics driver, ie. Vulkan/Metal?
bool XPMP2::GlobVars::bClampAll = false |
Clamp all planes to the ground? Default is false
as clamping is kinda expensive due to Y-Testing.
bool XPMP2::GlobVars::bDrawLabels = true |
Shall we draw aircraft labels?
bool XPMP2::GlobVars::bHandleDupId = false |
Handle duplicate XPMP2::Aircraft::modeS_id by overwriting with unique id.
bool XPMP2::GlobVars::bHasControlOfAIAircraft = false |
Do we control X-Plane's AI/Multiplayer planes?
bool XPMP2::GlobVars::bLabelCutOffAtVisibility = true |
Cut off labels at XP's reported visibility mit?
bool XPMP2::GlobVars::bLogMdlMatch = false |
Debug model matching?
bool XPMP2::GlobVars::bMapEnabled = true |
Do we feed X-Plane's maps with our aircraft positions?
bool XPMP2::GlobVars::bMapLabels = true |
Do we show labels with the aircraft icons?
bool XPMP2::GlobVars::bObjReplDataRefs = false |
Replace dataRefs in .obj
files on load? (defaults to OFF!)
bool XPMP2::GlobVars::bObjReplTextures = true |
Replace textures in .obj
files on load if needed?
bool XPMP2::GlobVars::bSoundAutoMuted = false |
Is sound currently being auto-muted?
bool XPMP2::GlobVars::bSoundAvail = false |
Is the sound system available?
bool XPMP2::GlobVars::bSoundForceFmodInstance = false |
Config: Force own FMOD instance?
bool XPMP2::GlobVars::bSoundMuteOnPause = true |
Config: Mute on Pause?
bool XPMP2::GlobVars::bSoundOnStartup = true |
Config: Start Sound on startup?
bool XPMP2::GlobVars::bXPNetworkedSetup = false |
Is X-Plane configured for networked multi-computer or multiplayer setup?
bool XPMP2::GlobVars::bXPUsingModernGraphicsDriver = false |
Using a modern graphics driver, ie. Vulkan/Metal?
std::string XPMP2::GlobVars::carIcaoType = "ZZZC" |
Ground vehicle type identifier (map decides icon based on this)
int XPMP2::GlobVars::contrailAltMax_ft = 45000 |
[ft] Auto Contrails: Maximum altitude
int XPMP2::GlobVars::contrailAltMin_ft = 25000 |
[ft] Auto Contrails: Minimum altitude
int XPMP2::GlobVars::contrailLifeTime = 25 |
[s] Contrail default time to live
bool XPMP2::GlobVars::contrailMulti = false |
Auto-create multiple or just a single contrail?
std::string XPMP2::GlobVars::defaultICAO = "A320" |
Default ICAO aircraft type designator if no match can be found.
ThreeWaySwitchTy XPMP2::GlobVars::eAIOverride = SWITCH_CFG_AUTO |
AI Control overriden in XPMP2.prf
?
ThreeWaySwitchTy XPMP2::GlobVars::eLabelOverride = SWITCH_CFG_AUTO |
Label drawing overriden in XPMP2.prf
?
float XPMP2::GlobVars::labelFontScaling = 1.0f |
Label font scaling factor.
listObj8DataRefsTy XPMP2::GlobVars::listObj8DataRefs |
List of dataRef replacement in .obj
files.
listXPMPPlaneNotifierTy XPMP2::GlobVars::listObservers |
List of notifier functions registered for being notified of creation/destruction/model change.
std::string XPMP2::GlobVars::logAcronym = UNKNOWN_PLUGIN_NAME |
Plugin acronym used in log output.
logLevelTy XPMP2::GlobVars::logLvl = logINFO |
Logging level.
mapAcTy XPMP2::GlobVars::mapAc |
Global map of all created planes.
mapCSLModelTy XPMP2::GlobVars::mapCSLModels |
Global map of all CSL Models, indexed by related group, aircraft type, and model id.
mapCSLPackageTy XPMP2::GlobVars::mapCSLPkgs |
Global map of all CSL Packages, indexed by xsb_aircraft.txt::EXPORT_NAME
mapDoc8643Ty XPMP2::GlobVars::mapDoc8643 |
Content of Doc8643.txt
file.
mapMapLayerIDTy XPMP2::GlobVars::mapMapLayers |
Map of map layer ids, i.e. for each map this is the id of the corresponding layer of ours.
std::array<mapRelatedTy,REL_TXT_NUM> XPMP2::GlobVars::mapRelated = {} |
Content of related.txt
and similar files as a map of keys to group id.
float XPMP2::GlobVars::maxLabelDist = 5556.0f |
Maximum distance for drawing labels? [m], defaults to 3nm.
std::string XPMP2::GlobVars::pathDoc8643 |
Path to Doc8643.txt file.
std::string XPMP2::GlobVars::pathMapIcons |
path to file containing plane icons for map display
std::string XPMP2::GlobVars::pathObj8DataRefs |
Path to the Obj8DataRefs.txt
file.
std::array<std::string,REL_TXT_NUM> XPMP2::GlobVars::pathRelated = {} |
Paths to related.txt, relOp.txt... files.
|
protected |
Current plane ID counter.
XPLMPluginID XPMP2::GlobVars::pluginId = 0 |
This plugin's id.
std::string XPMP2::GlobVars::pluginName = UNKNOWN_PLUGIN_NAME |
Name of the plugin we are serving (used as map layer name or for folders)
XPLMCameraPosition_t XPMP2::GlobVars::posCamera = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } |
Current camera location, updated every flight loop.
int(* XPMP2::GlobVars::prefsFuncInt) (const char *, const char *, int) = XPMP2::PrefsFuncIntDefault |
Configuration callback for integer values.
XPLMCameraPosition_t XPMP2::GlobVars::prevCamera = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } |
Previous camera location of about a second ago.
float XPMP2::GlobVars::prevCamera_ts = 0.0f |
When has prevCamera
been updated last?
size_t XPMP2::GlobVars::remoteBufSize = 8192 |
Buffer size, ie. max message length we send over multicast.
ThreeWaySwitchTy XPMP2::GlobVars::remoteCfg = SWITCH_CFG_AUTO |
Configuration: Are we to support remote connections?
ThreeWaySwitchTy XPMP2::GlobVars::remoteCfgFromIni = SWITCH_CFG_AUTO |
Configuration file entry: Are we to support remote connections?
std::string XPMP2::GlobVars::remoteMCGroup = "239.255.1.1" |
The multicast group that we use, which is the same X-Plane is using itself for its BEACON.
int XPMP2::GlobVars::remotePort = 49788 |
The port we use is different from the port the X-Plane BEACON uses, so we don't get into conflict.
std::string XPMP2::GlobVars::remoteSendIntf |
The interface used to send multicast on. (Empty == auto-discovery)
RemoteStatusTy XPMP2::GlobVars::remoteStatus = REMOTE_OFF |
Status of remote connections to networked clients.
int XPMP2::GlobVars::remoteTTL = 8 |
Time-to-live, or mumber of hops for a multicast message.
int XPMP2::GlobVars::remoteTxfFrequ = 5 |
Max transfer frequency per second.
std::string XPMP2::GlobVars::resourceDir |
Resource directory, to store local definitions of vertical offsets (clamping)
float XPMP2::GlobVars::sndMasterVol = 1.0f |
Sound master volume.
float XPMP2::GlobVars::vCam_x = 0.0f |
Camera velocity.
float XPMP2::GlobVars::vCam_y = 0.0f |
float XPMP2::GlobVars::vCam_z = 0.0f |
int XPMP2::GlobVars::verXPlane = -1 |
X-Plane's version number (XPLMGetVersions)
int XPMP2::GlobVars::verXPLM = -1 |
XPLM's SDK version number (XPLMGetVersions)
int XPMP2::GlobVars::xpCycleNum = 0 |
Current XP cycle number (see XPLMGetCycleNumber())
std::thread::id XPMP2::GlobVars::xpThread |
id of X-Plane's thread (when it is OK to use XP API calls)