Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Returns true if the supplied vessel is an XR vessel that supports XRVesselCtrl 1.5 or later
- static bool IsXRVesselCtrl(const VESSEL *pVessel)
- {
- // Let's figure out if the supplied vessel implements XRVesselCtrl.
- // Since we can't rely on RTTI here to test vessel objects that do not contain RTTI, we instead check
- // the status of an exported XRVesselCtrlFlag, if any.
- bool retVal = false; // assume not XRVesselCtrl
- const HMODULE hDLL = GetModuleHandle(pVessel->GetClassName());
- if (hDLL != NULL)
- {
- const bool *pFlag = reinterpret_cast<const bool *>(GetProcAddress(hDLL, "XRVesselCtrlFlag"));
- if (pFlag != NULL)
- retVal = *pFlag; // will be 'true' for vessels that implement XRVesselCtrl
- // Do not free hDLL handle here! GetModuleHandle does not increment the reference count.
- }
- return retVal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement