Add support for sendCOMM method

Credits go to user @angelsware, I just did a copy/paste from #120
This commit is contained in:
Sander Datema
2020-06-27 21:14:42 +02:00
parent 76f7d28ac8
commit 388329b218
10 changed files with 211 additions and 53 deletions

View File

@@ -19,6 +19,7 @@
#include "XPLMDataAccess.h"
#include "XPLMGraphics.h"
#include "XPLMUtilities.h"
#include <algorithm>
#include <cmath>
@@ -791,6 +792,21 @@ namespace XPC
Set(DREF_FlapActual, value);
}
void DataManager::Execute(const std::string& comm)
{
Log::FormatLine(LOG_INFO, "DMAN", "Executing command (value:%s)", comm.c_str());
XPLMCommandRef xcref = XPLMFindCommand(comm.c_str());
if (!xcref)
{
// COMM does not exist
Log::FormatLine(LOG_ERROR, "DMAN", "ERROR: invalid COMM %s", comm.c_str());
return;
}
XPLMCommandOnce(xcref);
}
float DataManager::GetDefaultValue()
{
return -998.0F;