1
0
Fork 0

FlightGear support for queued commands

This enables queued commands to be processed once per main event loop.
At present this is done after subsystem updates.
This commit is contained in:
James Turner 2019-03-24 17:59:23 +00:00
parent 6860627dea
commit 7c2a5e9e99
3 changed files with 11 additions and 1 deletions

View file

@ -970,6 +970,10 @@ static struct {
void void
fgInitCommands () fgInitCommands ()
{ {
// set our property root as the implicit default root for the
// command managr
SGCommandMgr::instance()->setImplicitRoot(globals->get_props());
SG_LOG(SG_GENERAL, SG_BULK, "Initializing basic built-in commands:"); SG_LOG(SG_GENERAL, SG_BULK, "Initializing basic built-in commands:");
for (int i = 0; built_ins[i].name != 0; i++) { for (int i = 0; built_ins[i].name != 0; i++) {
SG_LOG(SG_GENERAL, SG_BULK, " " << built_ins[i].name); SG_LOG(SG_GENERAL, SG_BULK, " " << built_ins[i].name);

View file

@ -1194,6 +1194,9 @@ void fgStartNewReset()
fgInitConfig(0, NULL, true); fgInitConfig(0, NULL, true);
fgInitGeneral(); // all of this? fgInitGeneral(); // all of this?
// set out new property root on the command manager
SGCommandMgr::instance()->setImplicitRoot(globals->get_props());
flightgear::Options::sharedInstance()->processOptions(); flightgear::Options::sharedInstance()->processOptions();
// Rebuild the lists of allowed paths for cases where a path comes from an // Rebuild the lists of allowed paths for cases where a path comes from an

View file

@ -55,6 +55,7 @@ extern bool global_crashRptEnabled;
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/structure/commands.hxx>
#include <Add-ons/AddonManager.hxx> #include <Add-ons/AddonManager.hxx>
#include <Main/locale.hxx> #include <Main/locale.hxx>
@ -122,6 +123,8 @@ static void fgMainLoop( void )
// update all subsystems // update all subsystems
globals->get_subsystem_mgr()->update(sim_dt); globals->get_subsystem_mgr()->update(sim_dt);
// flush commands waiting in the queue
SGCommandMgr::instance()->executedQueuedCommands();
simgear::AtomicChangeListener::fireChangeListeners(); simgear::AtomicChangeListener::fireChangeListeners();
} }