Conversation
a3bce29 to
01a0668
Compare
4091541 to
156bacb
Compare
oktal3700
left a comment
There was a problem hiding this comment.
There are just some cppcheck warnings
ltoenning
left a comment
There was a problem hiding this comment.
@tzobler Thanks for this PR! The new model loading approach looks very promising.
One potential concern: introducing a separate MSFS24 plugin seems to create a lot of duplication. Could some of this code be reused, perhaps by refactoring fsxcommon? Happy to discuss options for this in a quick chat if you like.
| { | ||
| // error to force popup | ||
| CLogMessage(this).error(u"No models for matching ('%1'), swift without a model set will not work!") | ||
| // TODO TZ extend commend |
| @@ -0,0 +1,26 @@ | |||
| // SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors | |||
There was a problem hiding this comment.
| // SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors | |
| // SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors |
Avoid misleading/wrong year
| //#include <SimConnect.h> | ||
| #include "../third_party/externals/common/include/simconnect/MSFS2024/SimConnect.h" |
There was a problem hiding this comment.
Should be fixed to not be such a relative path
| using DWORD = unsigned long; //!< Fake Windows DWORD | ||
| #endif | ||
|
|
||
| namespace swift::misc::simulation::msfs2024 |
There was a problem hiding this comment.
TODO Check and avoid duplication
| #include <SimConnect.h> | ||
| //#include <SimConnect.h> | ||
| #include "../third_party/externals/common/include/simconnect/P3D-v4/SimConnect.h" | ||
|
|
There was a problem hiding this comment.
relative include path should be fixed
| // TODO TZ handle flaps more precisely | ||
| // is already handled in parts definition above | ||
| // Sets flap handle to closest increment (0 to 16383) | ||
| // const DWORD flapsDw = static_cast<DWORD>(qMin(16383, qRound((parts.getFlapsPercent() / 100.0) * 16383))); | ||
| const HRESULT hr2 = S_OK; | ||
| // const HRESULT hr2 = this->logAndTraceSendId( | ||
| // SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventFlapsSet, flapsDw, | ||
| // SIMCONNECT_GROUP_PRIORITY_HIGHEST, | ||
| // SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY), | ||
| // traceId, simObject, "Failed so set flaps", Q_FUNC_INFO, "SimConnect_TransmitClientEvent::EventFlapsSet"); |
| SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY), | ||
| traceId, simObject, "Failed to set wing lights", Q_FUNC_INFO, | ||
| "SimConnect_TransmitClientEvent::EventWingLightsSet"); | ||
|
|
There was a problem hiding this comment.
In fsxcommon, setting lights is handled in a separate function (sendToggledLightsToSimulation).
If possible, refactor this also into a separate function.
| return this->getSimObjectForObjectId(objectId).getCallsign(); | ||
| } | ||
|
|
||
| // TODO TZ optimize? |
| return callsigns; | ||
| } | ||
|
|
||
| // TODO TZ optimize? |
| bool cont = false; | ||
| for (const CSimConnectObject &simObject : *this) | ||
| { | ||
| if (simObject.isPendingAdded()) | ||
| { | ||
|
|
||
| CLogMessage(this).info(u"containsPendingAdded %1 ") << simObject.getCallsign(); | ||
| cont = true; | ||
| } | ||
| } | ||
| if (cont) return true; | ||
| return false; |
There was a problem hiding this comment.
fsxcommon directly returns true here, if one simObject is pending to be added. Do we actually need to loop about all? Or was just done for logging?
This PR is stacked with #391 which should be merged first.