XPMP2
X-Plane multiplayer library 2 - using instancing
Public Member Functions | Public Attributes | Protected Attributes | List of all members
XPMP2::GlobVars Struct Reference

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_NUMpathRelated = {}
 Paths to related.txt, relOp.txt... files. More...
 
std::array< mapRelatedTy, REL_TXT_NUMmapRelated = {}
 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...
 

Detailed Description

All global config settings and variables are kept in one structure for convenient access and central definition.

Constructor & Destructor Documentation

◆ GlobVars()

XPMP2::GlobVars::GlobVars ( logLevelTy  _logLvl = logINFO,
bool  _logMdlMatch = false 
)
inline

Constructor.

Member Function Documentation

◆ IsXPThread()

bool XPMP2::GlobVars::IsXPThread ( ) const
inline

Is this thread XP's main thread?

◆ NextPlaneId()

XPMPPlaneID XPMP2::GlobVars::NextPlaneId ( )

Get the next unique artifical plane id.

◆ ReadConfigFile()

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.

◆ ReadVersions()

void XPMP2::GlobVars::ReadVersions ( )

Read version numbers into verXplane/verXPLM.

◆ remoteAutoDiscovery()

bool XPMP2::GlobVars::remoteAutoDiscovery ( ) const
inline

Use auto-discovery for the MC send interface?

◆ RemoteIsListener()

bool XPMP2::GlobVars::RemoteIsListener ( ) const
inline

Are we a listener?

◆ RemoteIsSender()

bool XPMP2::GlobVars::RemoteIsSender ( ) const
inline

Are we a sender?

◆ ThisThreadIsXP()

void XPMP2::GlobVars::ThisThreadIsXP ( )
inline

Set current thread as main xp Thread.

◆ UpdateCameraPos()

void XPMP2::GlobVars::UpdateCameraPos ( )

Update the stored camera position and velocity values.

◆ UpdateCfgVals()

void XPMP2::GlobVars::UpdateCfgVals ( )

Update all settings, e.g. for logging level, by calling prefsFuncInt.

◆ UsingModernGraphicsDriver()

bool XPMP2::GlobVars::UsingModernGraphicsDriver ( ) const
inline

Using a modern graphics driver, ie. Vulkan/Metal?

Member Data Documentation

◆ bClampAll

bool XPMP2::GlobVars::bClampAll = false

Clamp all planes to the ground? Default is false as clamping is kinda expensive due to Y-Testing.

◆ bDrawLabels

bool XPMP2::GlobVars::bDrawLabels = true

Shall we draw aircraft labels?

◆ bHandleDupId

bool XPMP2::GlobVars::bHandleDupId = false

Handle duplicate XPMP2::Aircraft::modeS_id by overwriting with unique id.

◆ bHasControlOfAIAircraft

bool XPMP2::GlobVars::bHasControlOfAIAircraft = false

Do we control X-Plane's AI/Multiplayer planes?

◆ bLabelCutOffAtVisibility

bool XPMP2::GlobVars::bLabelCutOffAtVisibility = true

Cut off labels at XP's reported visibility mit?

◆ bLogMdlMatch

bool XPMP2::GlobVars::bLogMdlMatch = false

Debug model matching?

◆ bMapEnabled

bool XPMP2::GlobVars::bMapEnabled = true

Do we feed X-Plane's maps with our aircraft positions?

◆ bMapLabels

bool XPMP2::GlobVars::bMapLabels = true

Do we show labels with the aircraft icons?

◆ bObjReplDataRefs

bool XPMP2::GlobVars::bObjReplDataRefs = false

Replace dataRefs in .obj files on load? (defaults to OFF!)

◆ bObjReplTextures

bool XPMP2::GlobVars::bObjReplTextures = true

Replace textures in .obj files on load if needed?

◆ bSoundAutoMuted

bool XPMP2::GlobVars::bSoundAutoMuted = false

Is sound currently being auto-muted?

◆ bSoundAvail

bool XPMP2::GlobVars::bSoundAvail = false

Is the sound system available?

◆ bSoundForceFmodInstance

bool XPMP2::GlobVars::bSoundForceFmodInstance = false

Config: Force own FMOD instance?

◆ bSoundMuteOnPause

bool XPMP2::GlobVars::bSoundMuteOnPause = true

Config: Mute on Pause?

◆ bSoundOnStartup

bool XPMP2::GlobVars::bSoundOnStartup = true

Config: Start Sound on startup?

◆ bXPNetworkedSetup

bool XPMP2::GlobVars::bXPNetworkedSetup = false

Is X-Plane configured for networked multi-computer or multiplayer setup?

◆ bXPUsingModernGraphicsDriver

bool XPMP2::GlobVars::bXPUsingModernGraphicsDriver = false

Using a modern graphics driver, ie. Vulkan/Metal?

◆ carIcaoType

std::string XPMP2::GlobVars::carIcaoType = "ZZZC"

Ground vehicle type identifier (map decides icon based on this)

◆ contrailAltMax_ft

int XPMP2::GlobVars::contrailAltMax_ft = 45000

[ft] Auto Contrails: Maximum altitude

◆ contrailAltMin_ft

int XPMP2::GlobVars::contrailAltMin_ft = 25000

[ft] Auto Contrails: Minimum altitude

◆ contrailLifeTime

int XPMP2::GlobVars::contrailLifeTime = 25

[s] Contrail default time to live

◆ contrailMulti

bool XPMP2::GlobVars::contrailMulti = false

Auto-create multiple or just a single contrail?

◆ defaultICAO

std::string XPMP2::GlobVars::defaultICAO = "A320"

Default ICAO aircraft type designator if no match can be found.

◆ eAIOverride

ThreeWaySwitchTy XPMP2::GlobVars::eAIOverride = SWITCH_CFG_AUTO

AI Control overriden in XPMP2.prf?

◆ eLabelOverride

ThreeWaySwitchTy XPMP2::GlobVars::eLabelOverride = SWITCH_CFG_AUTO

Label drawing overriden in XPMP2.prf?

◆ labelFontScaling

float XPMP2::GlobVars::labelFontScaling = 1.0f

Label font scaling factor.

◆ listObj8DataRefs

listObj8DataRefsTy XPMP2::GlobVars::listObj8DataRefs

List of dataRef replacement in .obj files.

◆ listObservers

listXPMPPlaneNotifierTy XPMP2::GlobVars::listObservers

List of notifier functions registered for being notified of creation/destruction/model change.

◆ logAcronym

std::string XPMP2::GlobVars::logAcronym = UNKNOWN_PLUGIN_NAME

Plugin acronym used in log output.

◆ logLvl

logLevelTy XPMP2::GlobVars::logLvl = logINFO

Logging level.

◆ mapAc

mapAcTy XPMP2::GlobVars::mapAc

Global map of all created planes.

◆ mapCSLModels

mapCSLModelTy XPMP2::GlobVars::mapCSLModels

Global map of all CSL Models, indexed by related group, aircraft type, and model id.

◆ mapCSLPkgs

mapCSLPackageTy XPMP2::GlobVars::mapCSLPkgs

Global map of all CSL Packages, indexed by xsb_aircraft.txt::EXPORT_NAME

◆ mapDoc8643

mapDoc8643Ty XPMP2::GlobVars::mapDoc8643

Content of Doc8643.txt file.

◆ mapMapLayers

mapMapLayerIDTy XPMP2::GlobVars::mapMapLayers

Map of map layer ids, i.e. for each map this is the id of the corresponding layer of ours.

◆ mapRelated

std::array<mapRelatedTy,REL_TXT_NUM> XPMP2::GlobVars::mapRelated = {}

Content of related.txt and similar files as a map of keys to group id.

◆ maxLabelDist

float XPMP2::GlobVars::maxLabelDist = 5556.0f

Maximum distance for drawing labels? [m], defaults to 3nm.

◆ pathDoc8643

std::string XPMP2::GlobVars::pathDoc8643

Path to Doc8643.txt file.

◆ pathMapIcons

std::string XPMP2::GlobVars::pathMapIcons

path to file containing plane icons for map display

◆ pathObj8DataRefs

std::string XPMP2::GlobVars::pathObj8DataRefs

Path to the Obj8DataRefs.txt file.

◆ pathRelated

std::array<std::string,REL_TXT_NUM> XPMP2::GlobVars::pathRelated = {}

Paths to related.txt, relOp.txt... files.

◆ planeId

XPMPPlaneID XPMP2::GlobVars::planeId = 0
protected

Current plane ID counter.

◆ pluginId

XPLMPluginID XPMP2::GlobVars::pluginId = 0

This plugin's id.

◆ pluginName

std::string XPMP2::GlobVars::pluginName = UNKNOWN_PLUGIN_NAME

Name of the plugin we are serving (used as map layer name or for folders)

◆ posCamera

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.

◆ prefsFuncInt

int(* XPMP2::GlobVars::prefsFuncInt) (const char *, const char *, int) = XPMP2::PrefsFuncIntDefault

Configuration callback for integer values.

◆ prevCamera

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.

◆ prevCamera_ts

float XPMP2::GlobVars::prevCamera_ts = 0.0f

When has prevCamera been updated last?

◆ remoteBufSize

size_t XPMP2::GlobVars::remoteBufSize = 8192

Buffer size, ie. max message length we send over multicast.

◆ remoteCfg

ThreeWaySwitchTy XPMP2::GlobVars::remoteCfg = SWITCH_CFG_AUTO

Configuration: Are we to support remote connections?

◆ remoteCfgFromIni

ThreeWaySwitchTy XPMP2::GlobVars::remoteCfgFromIni = SWITCH_CFG_AUTO

Configuration file entry: Are we to support remote connections?

◆ remoteMCGroup

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.

See also
<X-Plane>/Instructions/Exchanging Data with X-Plane.rtfd, chapter "DISCOVER X-PLANE BY A BEACON"

◆ remotePort

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.

◆ remoteSendIntf

std::string XPMP2::GlobVars::remoteSendIntf

The interface used to send multicast on. (Empty == auto-discovery)

◆ remoteStatus

RemoteStatusTy XPMP2::GlobVars::remoteStatus = REMOTE_OFF

Status of remote connections to networked clients.

◆ remoteTTL

int XPMP2::GlobVars::remoteTTL = 8

Time-to-live, or mumber of hops for a multicast message.

◆ remoteTxfFrequ

int XPMP2::GlobVars::remoteTxfFrequ = 5

Max transfer frequency per second.

◆ resourceDir

std::string XPMP2::GlobVars::resourceDir

Resource directory, to store local definitions of vertical offsets (clamping)

◆ sndMasterVol

float XPMP2::GlobVars::sndMasterVol = 1.0f

Sound master volume.

◆ vCam_x

float XPMP2::GlobVars::vCam_x = 0.0f

Camera velocity.

◆ vCam_y

float XPMP2::GlobVars::vCam_y = 0.0f

◆ vCam_z

float XPMP2::GlobVars::vCam_z = 0.0f

◆ verXPlane

int XPMP2::GlobVars::verXPlane = -1

X-Plane's version number (XPLMGetVersions)

◆ verXPLM

int XPMP2::GlobVars::verXPLM = -1

XPLM's SDK version number (XPLMGetVersions)

◆ xpCycleNum

int XPMP2::GlobVars::xpCycleNum = 0

Current XP cycle number (see XPLMGetCycleNumber())

◆ xpThread

std::thread::id XPMP2::GlobVars::xpThread

id of X-Plane's thread (when it is OK to use XP API calls)


The documentation for this struct was generated from the following files: