summaryrefslogtreecommitdiffhomepage
path: root/proto-simconnect/ftnoir_protocol_sc.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-26 22:25:22 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:05:21 +0200
commitd65936200a2756e6619a109fa6fa673b91df802e (patch)
tree80b6b6fc7ba9023cbe47290b8ae1bc5468a19bb1 /proto-simconnect/ftnoir_protocol_sc.cpp
parent4046773c41ee3c0f65840828ab983cfd13451c85 (diff)
modernize C++ syntax
No visible changes (hopefully).
Diffstat (limited to 'proto-simconnect/ftnoir_protocol_sc.cpp')
-rw-r--r--proto-simconnect/ftnoir_protocol_sc.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp
index 05cc3d0b..ab4a85dd 100644
--- a/proto-simconnect/ftnoir_protocol_sc.cpp
+++ b/proto-simconnect/ftnoir_protocol_sc.cpp
@@ -14,10 +14,6 @@
#include "compat/timer.hpp"
#include "compat/library-path.hpp"
-simconnect::simconnect() : hSimConnect(nullptr), should_reconnect(false)
-{
-}
-
simconnect::~simconnect()
{
requestInterruption();
@@ -112,11 +108,8 @@ void simconnect::pose( const double *headpose )
class ActivationContext
{
public:
- ActivationContext(const int resid) :
- ok(false)
+ explicit ActivationContext(int resid)
{
- hactctx = INVALID_HANDLE_VALUE;
- actctx_cookie = 0;
ACTCTXA actx = {};
actx.cbSize = sizeof(actx);
actx.lpResourceName = MAKEINTRESOURCEA(resid);
@@ -126,7 +119,6 @@ public:
QByteArray name = QFile::encodeName(path);
actx.lpSource = name.constData();
hactctx = CreateActCtxA(&actx);
- actctx_cookie = 0;
if (hactctx != INVALID_HANDLE_VALUE)
{
if (!ActivateActCtx(hactctx, &actctx_cookie))
@@ -151,9 +143,9 @@ public:
bool is_ok() const { return ok; }
private:
- ULONG_PTR actctx_cookie;
- HANDLE hactctx;
- bool ok;
+ ULONG_PTR actctx_cookie = 0;
+ HANDLE hactctx = INVALID_HANDLE_VALUE;
+ bool ok = false;
};
module_status simconnect::initialize()
@@ -174,27 +166,22 @@ module_status simconnect::initialize()
}
simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open");
- if (simconnect_open == NULL) {
+ if (!simconnect_open)
return error("Open function not found in DLL!");
- }
simconnect_set6DOF = (importSimConnect_CameraSetRelative6DOF) SCClientLib.resolve("SimConnect_CameraSetRelative6DOF");
- if (simconnect_set6DOF == NULL) {
+ if (!simconnect_set6DOF)
return error("CameraSetRelative6DOF function not found in DLL!");
- }
simconnect_close = (importSimConnect_Close) SCClientLib.resolve("SimConnect_Close");
- if (simconnect_close == NULL) {
+ if (!simconnect_close)
return error("Close function not found in DLL!");
- }
simconnect_calldispatch = (importSimConnect_CallDispatch) SCClientLib.resolve("SimConnect_CallDispatch");
- if (simconnect_calldispatch == NULL) {
+ if (!simconnect_calldispatch)
return error("CallDispatch function not found in DLL!");
- }
simconnect_subscribetosystemevent = (importSimConnect_SubscribeToSystemEvent) SCClientLib.resolve("SimConnect_SubscribeToSystemEvent");
- if (simconnect_subscribetosystemevent == NULL) {
+ if (!simconnect_subscribetosystemevent)
return error("SubscribeToSystemEvent function not found in DLL!");
- }
start();