[swift] cleanup functions

This commit is contained in:
Mathew Sutcliffe
2014-06-22 01:56:11 +01:00
parent 20efe9a5f5
commit cdef678e61
2 changed files with 28 additions and 0 deletions

View File

@@ -272,6 +272,22 @@ const char * XPMPMultiplayerInit(
*/
const char * XPMPMultiplayerEnable(void);
/*
* XPMPMultiplayerDisable
*
* Disable drawing of multiplayer planes. Call this from XPluginDisable to release multiplayer.
* Reverses the actions on XPMPMultiplayerEnable.
*/
void XPMPMultiplayerDisable(void);
/*
* XPMPMultiplayerCleanup
*
* Clean up the multiplayer library. Call this from XPluginStop to reverse the actions of
* XPMPMultiplayerInit as much as possible.
*/
void XPMPMultiplayerCleanup(void);
/*
* XPMPLoadPlanesIfNecessary
*

View File

@@ -150,6 +150,13 @@ const char * XPMPMultiplayerInit(
else return "";
}
void XPMPMultiplayerCleanup(void)
{
XPLMUnregisterDrawCallback(XPMPControlPlaneCount, xplm_Phase_Gauges, 0, 0);
XPLMUnregisterDrawCallback(XPMPControlPlaneCount, xplm_Phase_Gauges, 1, (void *) -1);
XPLMUnregisterDrawCallback(XPMPRenderMultiplayerPlanes, xplm_Phase_Airplanes, 0, 0);
}
// We use this array to track Austin's planes, since we have to mess with them.
static vector<string> gPlanePaths;
@@ -210,6 +217,11 @@ const char * XPMPMultiplayerEnable(void)
return "";
}
void XPMPMultiplayerDisable(void)
{
XPLMReleasePlanes();
}
// This routine checks plane loading and grabs anyone we're missing.
void XPMPLoadPlanesIfNecessary(void)