diff --git a/include/XPMPMultiplayer.h b/include/XPMPMultiplayer.h index 0f18f8543..63b5485df 100644 --- a/include/XPMPMultiplayer.h +++ b/include/XPMPMultiplayer.h @@ -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 * diff --git a/src/XPMPMultiplayer.cpp b/src/XPMPMultiplayer.cpp index c8cf143d7..d42247d0c 100644 --- a/src/XPMPMultiplayer.cpp +++ b/src/XPMPMultiplayer.cpp @@ -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 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)