SGSubsystemMgr::get_subsystem(): Universal switch to the templated function.
The globals non-templated get_subsystem() helper function has been made private to enforce the switch.
This commit is contained in:
parent
c5aa3ca0f1
commit
c1c7b043ac
74 changed files with 173 additions and 168 deletions
|
@ -394,7 +394,7 @@ which you can pass arbitrary Nasal source code for immediate
|
||||||
execution:
|
execution:
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
FGNasalSys n = (FGNasalSys*)globals->get_subsystem("nasal");
|
auto n = globals->get_subsystem<FGNasalSys>();
|
||||||
if(! n->parseAndRun("print('This script was called from C++!')"))
|
if(! n->parseAndRun("print('This script was called from C++!')"))
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "My Nasal code failed :(");
|
SG_LOG(SG_GENERAL, SG_ALERT, "My Nasal code failed :(");
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -408,7 +408,7 @@ avoids the parsing and code generation overhead for the successive
|
||||||
calls.
|
calls.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
FGNasalSys n = (FGNasalSys*)globals->get_subsystem("nasal");
|
auto n = globals->get_subsystem<FGNasalSys>();
|
||||||
FGNasalScript* script = n->parseScript("print('Spam!')"))
|
FGNasalScript* script = n->parseScript("print('Spam!')"))
|
||||||
if(!script) SG_LOG(SG_GENERAL, SG_ALERT, "My Nasal code failed :(");
|
if(!script) SG_LOG(SG_GENERAL, SG_ALERT, "My Nasal code failed :(");
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,8 @@ FGAIAircraft::FGAIAircraft(FGAISchedule* ref) : /* HOT must be disabled for AI A
|
||||||
prevSpeed = 0.0;
|
prevSpeed = 0.0;
|
||||||
prev_dist_to_go = 0.0;
|
prev_dist_to_go = 0.0;
|
||||||
|
|
||||||
PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
|
auto perfDB = globals->get_subsystem<PerformanceDB>();
|
||||||
|
|
||||||
if (perfDB) {
|
if (perfDB) {
|
||||||
_performance = perfDB->getDefaultPerformance();
|
_performance = perfDB->getDefaultPerformance();
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,7 +185,7 @@ void FGAIAircraft::unbind()
|
||||||
|
|
||||||
void FGAIAircraft::setPerformance(const std::string& acType, const std::string& acclass)
|
void FGAIAircraft::setPerformance(const std::string& acType, const std::string& acclass)
|
||||||
{
|
{
|
||||||
PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
|
auto perfDB = globals->get_subsystem<PerformanceDB>();
|
||||||
if (perfDB) {
|
if (perfDB) {
|
||||||
_performance = perfDB->getDataFor(acType, acclass);
|
_performance = perfDB->getDataFor(acType, acclass);
|
||||||
}
|
}
|
||||||
|
|
|
@ -801,7 +801,7 @@ std::pair<bool, SGGeod> FGAICarrier::initialPositionForCarrier(const std::string
|
||||||
|
|
||||||
SGSharedPtr<FGAICarrier> FGAICarrier::findCarrierByNameOrPennant(const std::string& namePennant)
|
SGSharedPtr<FGAICarrier> FGAICarrier::findCarrierByNameOrPennant(const std::string& namePennant)
|
||||||
{
|
{
|
||||||
const FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
const auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||||
if (!aiManager) {
|
if (!aiManager) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
_unloadScript = nasalScripts->getStringValue("unload");
|
_unloadScript = nasalScripts->getStringValue("unload");
|
||||||
std::string loadScript = nasalScripts->getStringValue("load");
|
std::string loadScript = nasalScripts->getStringValue("load");
|
||||||
if (!loadScript.empty()) {
|
if (!loadScript.empty()) {
|
||||||
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
std::string moduleName = "scenario_" + _internalName;
|
std::string moduleName = "scenario_" + _internalName;
|
||||||
bool ok = nasalSys->createModule(moduleName.c_str(), moduleName.c_str(),
|
bool ok = nasalSys->createModule(moduleName.c_str(), moduleName.c_str(),
|
||||||
loadScript.c_str(), loadScript.size(),
|
loadScript.c_str(), loadScript.size(),
|
||||||
|
@ -94,7 +94,7 @@ public:
|
||||||
[](FGAIBasePtr ai) { ai->setDie(true); });
|
[](FGAIBasePtr ai) { ai->setDie(true); });
|
||||||
|
|
||||||
|
|
||||||
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
if (!nasalSys) // happens during shutdown / reset
|
if (!nasalSys) // happens during shutdown / reset
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ bool FGGroundController::checkTransmissionState(int minState, int maxState, Traf
|
||||||
trans_num->setIntValue(-1);
|
trans_num->setIntValue(-1);
|
||||||
// PopupCallback(n);
|
// PopupCallback(n);
|
||||||
SG_LOG(SG_ATC, SG_DEBUG, "Selected transmission message " << n);
|
SG_LOG(SG_ATC, SG_DEBUG, "Selected transmission message " << n);
|
||||||
//FGATCManager *atc = (FGATCManager*) globals->get_subsystem("atc");
|
//auto atc = globals->get_subsystem<FGATCManager>();
|
||||||
//FGATCDialogNew::instance()->removeEntry(1);
|
//FGATCDialogNew::instance()->removeEntry(1);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_ATC, SG_DEBUG, "creating message for " << i->getAircraft()->getCallSign());
|
SG_LOG(SG_ATC, SG_DEBUG, "creating message for " << i->getAircraft()->getCallSign());
|
||||||
|
|
|
@ -82,7 +82,7 @@ void FGATCManager::postinit()
|
||||||
_routeManagerDestinationAirportNode = globals->get_props()->getNode("/autopilot/route-manager/destination/airport", true);
|
_routeManagerDestinationAirportNode = globals->get_props()->getNode("/autopilot/route-manager/destination/airport", true);
|
||||||
destination = _routeManagerDestinationAirportNode->getStringValue();
|
destination = _routeManagerDestinationAirportNode->getStringValue();
|
||||||
|
|
||||||
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||||
auto userAircraft = aiManager->getUserAircraft();
|
auto userAircraft = aiManager->getUserAircraft();
|
||||||
string callsign = userAircraft->getCallSign();
|
string callsign = userAircraft->getCallSign();
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ void FGATCManager::reposition()
|
||||||
|
|
||||||
// remove any parking assignment form the user flight-plan, so it's
|
// remove any parking assignment form the user flight-plan, so it's
|
||||||
// available again. postinit() will recompute a new value if required
|
// available again. postinit() will recompute a new value if required
|
||||||
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||||
auto userAircraft = aiManager->getUserAircraft();
|
auto userAircraft = aiManager->getUserAircraft();
|
||||||
if (userAircraft) {
|
if (userAircraft) {
|
||||||
if (userAircraft->GetFlightPlan()) {
|
if (userAircraft->GetFlightPlan()) {
|
||||||
|
@ -303,7 +303,7 @@ void FGATCManager::update ( double time ) {
|
||||||
// SG_LOG(SG_ATC, SG_BULK, "ATC update code is running at time: " << time);
|
// SG_LOG(SG_ATC, SG_BULK, "ATC update code is running at time: " << time);
|
||||||
|
|
||||||
// Test code: let my virtual co-pilot handle ATC
|
// Test code: let my virtual co-pilot handle ATC
|
||||||
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||||
FGAIAircraft* user_ai_ac = aiManager->getUserAircraft();
|
FGAIAircraft* user_ai_ac = aiManager->getUserAircraft();
|
||||||
FGAIFlightPlan *fp = user_ai_ac->GetFlightPlan();
|
FGAIFlightPlan *fp = user_ai_ac->GetFlightPlan();
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ void Addon::setAddonNode(SGPropertyNode* addonNode)
|
||||||
|
|
||||||
naRef Addon::getAddonPropsNode() const
|
naRef Addon::getAddonPropsNode() const
|
||||||
{
|
{
|
||||||
FGNasalSys* nas = globals->get_subsystem<FGNasalSys>();
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
return nas->wrappedPropsNode(_addonNode.get());
|
return nas->wrappedPropsNode(_addonNode.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ FGAirportDynamicsRef AirportDynamicsManager::find(const std::string &icao)
|
||||||
if (icao.empty())
|
if (icao.empty())
|
||||||
return FGAirportDynamicsRef();
|
return FGAirportDynamicsRef();
|
||||||
|
|
||||||
AirportDynamicsManager* instance = globals->get_subsystem<AirportDynamicsManager>();
|
auto instance = globals->get_subsystem<AirportDynamicsManager>();
|
||||||
if (!instance)
|
if (!instance)
|
||||||
return FGAirportDynamicsRef();
|
return FGAirportDynamicsRef();
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ private:
|
||||||
void populate()
|
void populate()
|
||||||
{
|
{
|
||||||
SGVec3d cartAirportPos = m_airport->cart();
|
SGVec3d cartAirportPos = m_airport->cart();
|
||||||
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||||
for (auto ai : aiManager->get_ai_list()) {
|
for (auto ai : aiManager->get_ai_list()) {
|
||||||
const auto cart = ai->getCartPos();
|
const auto cart = ai->getCartPos();
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ bool FGAirportDynamics::innerGetActiveRunway(const string & trafficType,
|
||||||
/*
|
/*
|
||||||
FGEnvironment
|
FGEnvironment
|
||||||
stationweather =
|
stationweather =
|
||||||
((FGEnvironmentMgr *) globals->get_subsystem("environment"))
|
globals->get_subsystem<FGEnvironmentMgr>()
|
||||||
->getEnvironment(getLatitude(), getLongitude(),
|
->getEnvironment(getLatitude(), getLongitude(),
|
||||||
getElevation());
|
getElevation());
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -925,7 +925,7 @@ bool DigitalFilter::configure( SGPropertyNode& prop_root,
|
||||||
_implementation->collectDependentProperties(inputs);
|
_implementation->collectDependentProperties(inputs);
|
||||||
collectDependentProperties(inputs);
|
collectDependentProperties(inputs);
|
||||||
|
|
||||||
Highlight* highlight = globals->get_subsystem<Highlight>();
|
auto highlight = globals->get_subsystem<Highlight>();
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
for (auto in: inputs) {
|
for (auto in: inputs) {
|
||||||
for (auto& out: _output_list) {
|
for (auto& out: _output_list) {
|
||||||
|
|
|
@ -59,14 +59,14 @@ namespace su = simgear::strutils;
|
||||||
|
|
||||||
static bool commandLoadFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
|
static bool commandLoadFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
{
|
{
|
||||||
FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
|
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||||
SGPath path = SGPath::fromUtf8(arg->getStringValue("path"));
|
SGPath path = SGPath::fromUtf8(arg->getStringValue("path"));
|
||||||
return self->loadRoute(path);
|
return self->loadRoute(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool commandSaveFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
|
static bool commandSaveFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
{
|
{
|
||||||
FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
|
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||||
SGPath path = SGPath::fromUtf8(arg->getStringValue("path"));
|
SGPath path = SGPath::fromUtf8(arg->getStringValue("path"));
|
||||||
const SGPath authorizedPath = SGPath(path).validate(true /* write */);
|
const SGPath authorizedPath = SGPath(path).validate(true /* write */);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ static bool commandSaveFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
|
|
||||||
static bool commandActivateFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
|
static bool commandActivateFlightPlan(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
{
|
{
|
||||||
FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
|
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||||
bool activate = arg->getBoolValue("activate", true);
|
bool activate = arg->getBoolValue("activate", true);
|
||||||
if (activate) {
|
if (activate) {
|
||||||
self->activate();
|
self->activate();
|
||||||
|
@ -101,14 +101,14 @@ static bool commandActivateFlightPlan(const SGPropertyNode* arg, SGPropertyNode
|
||||||
|
|
||||||
static bool commandClearFlightPlan(const SGPropertyNode*, SGPropertyNode *)
|
static bool commandClearFlightPlan(const SGPropertyNode*, SGPropertyNode *)
|
||||||
{
|
{
|
||||||
FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
|
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||||
self->clearRoute();
|
self->clearRoute();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool commandSetActiveWaypt(const SGPropertyNode* arg, SGPropertyNode *)
|
static bool commandSetActiveWaypt(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
{
|
{
|
||||||
FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
|
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||||
int index = arg->getIntValue("index");
|
int index = arg->getIntValue("index");
|
||||||
if ((index < 0) || (index >= self->numLegs())) {
|
if ((index < 0) || (index >= self->numLegs())) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -120,7 +120,7 @@ static bool commandSetActiveWaypt(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
|
|
||||||
static bool commandInsertWaypt(const SGPropertyNode* arg, SGPropertyNode *)
|
static bool commandInsertWaypt(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
{
|
{
|
||||||
FGRouteMgr* self = globals->get_subsystem<FGRouteMgr>();
|
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||||
const bool haveIndex = arg->hasChild("index");
|
const bool haveIndex = arg->hasChild("index");
|
||||||
int index = arg->getIntValue("index");
|
int index = arg->getIntValue("index");
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ static bool commandInsertWaypt(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
|
|
||||||
static bool commandDeleteWaypt(const SGPropertyNode* arg, SGPropertyNode *)
|
static bool commandDeleteWaypt(const SGPropertyNode* arg, SGPropertyNode *)
|
||||||
{
|
{
|
||||||
FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
|
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||||
int index = arg->getIntValue("index");
|
int index = arg->getIntValue("index");
|
||||||
self->removeLegAtIndex(index);
|
self->removeLegAtIndex(index);
|
||||||
return true;
|
return true;
|
||||||
|
@ -673,7 +673,7 @@ void FGRouteMgr::update_mirror()
|
||||||
{
|
{
|
||||||
_routePath.reset(); // wipe this so we re-compute on next update()
|
_routePath.reset(); // wipe this so we re-compute on next update()
|
||||||
mirror->removeChildren("wp");
|
mirror->removeChildren("wp");
|
||||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
FGDialog* rmDlg = gui ? gui->getDialog("route-manager") : NULL;
|
FGDialog* rmDlg = gui ? gui->getDialog("route-manager") : NULL;
|
||||||
|
|
||||||
if (!_plan) {
|
if (!_plan) {
|
||||||
|
|
|
@ -109,13 +109,13 @@ namespace canvas
|
||||||
SGSubsystem*
|
SGSubsystem*
|
||||||
FGCanvasSystemAdapter::getSubsystem(const std::string& name) const
|
FGCanvasSystemAdapter::getSubsystem(const std::string& name) const
|
||||||
{
|
{
|
||||||
return globals->get_subsystem(name.c_str());
|
return globals->get_subsystem_mgr()->get_subsystem(name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
simgear::HTTP::Client* FGCanvasSystemAdapter::getHTTPClient() const
|
simgear::HTTP::Client* FGCanvasSystemAdapter::getHTTPClient() const
|
||||||
{
|
{
|
||||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||||
|
|
||||||
if( http )
|
if( http )
|
||||||
return http->client();
|
return http->client();
|
||||||
|
|
|
@ -514,7 +514,7 @@ NavDisplay::init ()
|
||||||
_odg = new FGODGauge;
|
_odg = new FGODGauge;
|
||||||
_odg->setSize(_Instrument->getIntValue("texture-size", 512));
|
_odg->setSize(_Instrument->getIntValue("texture-size", 512));
|
||||||
|
|
||||||
_route = static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"));
|
_route = globals->get_subsystem<FGRouteMgr>();
|
||||||
|
|
||||||
_navRadio1Node = fgGetNode("/instrumentation/nav[0]", true);
|
_navRadio1Node = fgGetNode("/instrumentation/nav[0]", true);
|
||||||
_navRadio2Node = fgGetNode("/instrumentation/nav[1]", true);
|
_navRadio2Node = fgGetNode("/instrumentation/nav[1]", true);
|
||||||
|
|
|
@ -289,7 +289,7 @@ FGPanel::draw(osg::State& state)
|
||||||
state.setActiveTextureUnit(0);
|
state.setActiveTextureUnit(0);
|
||||||
state.setClientActiveTextureUnit(0);
|
state.setClientActiveTextureUnit(0);
|
||||||
|
|
||||||
FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
|
auto l = globals->get_subsystem<FGLight>();
|
||||||
sgCopyVec4( panel_color, l->scene_diffuse().data());
|
sgCopyVec4( panel_color, l->scene_diffuse().data());
|
||||||
if ( fgGetDouble("/systems/electrical/outputs/instrument-lights") > 1.0 ) {
|
if ( fgGetDouble("/systems/electrical/outputs/instrument-lights") > 1.0 ) {
|
||||||
if ( panel_color[0] < 0.7 ) panel_color[0] = 0.7;
|
if ( panel_color[0] < 0.7 ) panel_color[0] = 0.7;
|
||||||
|
|
|
@ -779,7 +779,7 @@ readPanel (const SGPropertyNode * root, const SGPath& path)
|
||||||
|
|
||||||
// Warning - hardwired size!!!
|
// Warning - hardwired size!!!
|
||||||
RenderArea2D* instrument = new RenderArea2D(158, 40, 158, 40, x, y);
|
RenderArea2D* instrument = new RenderArea2D(158, 40, 158, 40, x, y);
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
if (gps == NULL) {
|
if (gps == NULL) {
|
||||||
gps = new KLN89(instrument);
|
gps = new KLN89(instrument);
|
||||||
globals->get_subsystem_mgr()->add("kln89", gps);
|
globals->get_subsystem_mgr()->add("kln89", gps);
|
||||||
|
|
|
@ -145,7 +145,7 @@ void FGClimate::reinit()
|
||||||
// http://vectormap.si.edu/Climate.htm
|
// http://vectormap.si.edu/Climate.htm
|
||||||
void FGClimate::update(double dt)
|
void FGClimate::update(double dt)
|
||||||
{
|
{
|
||||||
FGLight *l = globals->get_subsystem<FGLight>();
|
auto l = globals->get_subsystem<FGLight>();
|
||||||
if (l)
|
if (l)
|
||||||
{
|
{
|
||||||
_sun_longitude_deg = l->get_sun_lon()*SGD_RADIANS_TO_DEGREES;
|
_sun_longitude_deg = l->get_sun_lon()*SGD_RADIANS_TO_DEGREES;
|
||||||
|
|
|
@ -203,7 +203,7 @@ protected:
|
||||||
|
|
||||||
static bool commandRequestMetar(const SGPropertyNode * arg, SGPropertyNode * root)
|
static bool commandRequestMetar(const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
SGSubsystemGroup* envMgr = (SGSubsystemGroup*) globals->get_subsystem("environment");
|
auto envMgr = (SGSubsystemGroup*) globals->get_subsystem_mgr()->get_subsystem("environment");
|
||||||
if (!envMgr) {
|
if (!envMgr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ static bool commandRequestMetar(const SGPropertyNode * arg, SGPropertyNode * roo
|
||||||
|
|
||||||
static bool commandClearMetar(const SGPropertyNode * arg, SGPropertyNode * root)
|
static bool commandClearMetar(const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
SGSubsystemGroup* envMgr = (SGSubsystemGroup*) globals->get_subsystem("environment");
|
auto envMgr = (SGSubsystemGroup*) globals->get_subsystem_mgr()->get_subsystem("environment");
|
||||||
if (!envMgr) {
|
if (!envMgr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ void NoaaMetarRealWxController::requestMetar
|
||||||
"NoaaMetarRealWxController::update(): "
|
"NoaaMetarRealWxController::update(): "
|
||||||
"spawning load request for station-id '" << upperId << "'"
|
"spawning load request for station-id '" << upperId << "'"
|
||||||
);
|
);
|
||||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||||
if (http) {
|
if (http) {
|
||||||
http->makeRequest(new NoaaMetarGetRequest(metarDataHandler, upperId, noaa_base_url));
|
http->makeRequest(new NoaaMetarGetRequest(metarDataHandler, upperId, noaa_base_url));
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ CanvasWidget::CanvasWidget( int x, int y,
|
||||||
if( !nasal )
|
if( !nasal )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FGNasalSys *nas = globals->get_subsystem<FGNasalSys>();
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
if( !nas )
|
if( !nas )
|
||||||
SG_LOG( SG_GENERAL,
|
SG_LOG( SG_GENERAL,
|
||||||
SG_ALERT,
|
SG_ALERT,
|
||||||
|
|
|
@ -201,7 +201,7 @@ void CatalogListModel::refreshCatalog(int index)
|
||||||
|
|
||||||
void CatalogListModel::installDefaultCatalog(bool showAddFeedback)
|
void CatalogListModel::installDefaultCatalog(bool showAddFeedback)
|
||||||
{
|
{
|
||||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||||
CatalogRef cat = Catalog::createFromUrl(m_packageRoot, http->getDefaultCatalogUrl());
|
CatalogRef cat = Catalog::createFromUrl(m_packageRoot, http->getDefaultCatalogUrl());
|
||||||
if (showAddFeedback) {
|
if (showAddFeedback) {
|
||||||
m_newlyAddedCatalog = cat;
|
m_newlyAddedCatalog = cat;
|
||||||
|
@ -290,7 +290,7 @@ void CatalogListModel::onCatalogStatusChanged(Catalog* cat)
|
||||||
// compute the version-specific URL. This is the logic which bounces the UI
|
// compute the version-specific URL. This is the logic which bounces the UI
|
||||||
// to the fallback URL.
|
// to the fallback URL.
|
||||||
if (cat->status() == Delegate::FAIL_NOT_FOUND) {
|
if (cat->status() == Delegate::FAIL_NOT_FOUND) {
|
||||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||||
if (cat->url() == http->getDefaultCatalogUrl()) {
|
if (cat->url() == http->getDefaultCatalogUrl()) {
|
||||||
cat->setUrl(http->getDefaultCatalogFallbackUrl());
|
cat->setUrl(http->getDefaultCatalogFallbackUrl());
|
||||||
cat->refresh(); // and trigger another refresh
|
cat->refresh(); // and trigger another refresh
|
||||||
|
|
|
@ -476,7 +476,7 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
|
||||||
obj->setBuffer(tsync->log());
|
obj->setBuffer(tsync->log());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FGNasalSys* nasal = (FGNasalSys*)globals->get_subsystem("nasal");
|
auto nasal = globals->get_subsystem<FGNasalSys>();
|
||||||
obj->setBuffer(nasal->log());
|
obj->setBuffer(nasal->log());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -576,7 +576,7 @@ static void
|
||||||
action_callback(puObject* object)
|
action_callback(puObject* object)
|
||||||
{
|
{
|
||||||
GUIInfo* info = (GUIInfo*)object->getUserData();
|
GUIInfo* info = (GUIInfo*)object->getUserData();
|
||||||
NewGUI* gui = (NewGUI*)globals->get_subsystem("gui");
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
gui->setActiveDialog(info->dialog);
|
gui->setActiveDialog(info->dialog);
|
||||||
int nBindings = info->bindings.size();
|
int nBindings = info->bindings.size();
|
||||||
for (int i = 0; i < nBindings; i++) {
|
for (int i = 0; i < nBindings; i++) {
|
||||||
|
@ -1087,7 +1087,7 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
|
||||||
obj->setBuffer(tsync->log());
|
obj->setBuffer(tsync->log());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FGNasalSys* nasal = (FGNasalSys*)globals->get_subsystem("nasal");
|
auto nasal = globals->get_subsystem<FGNasalSys>();
|
||||||
obj->setBuffer(nasal->log());
|
obj->setBuffer(nasal->log());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ add_deprecated_dialogs ()
|
||||||
static void
|
static void
|
||||||
menu_callback (puObject * object)
|
menu_callback (puObject * object)
|
||||||
{
|
{
|
||||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
FGPUIMenuBar* mb = static_cast<FGPUIMenuBar*>(gui->getMenuBar());
|
FGPUIMenuBar* mb = static_cast<FGPUIMenuBar*>(gui->getMenuBar());
|
||||||
mb->fireItem(object);
|
mb->fireItem(object);
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ namespace {
|
||||||
|
|
||||||
struct EnabledListener : SGPropertyChangeListener {
|
struct EnabledListener : SGPropertyChangeListener {
|
||||||
void valueChanged(SGPropertyNode *node) {
|
void valueChanged(SGPropertyNode *node) {
|
||||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
if (!gui)
|
if (!gui)
|
||||||
return;
|
return;
|
||||||
FGPUIMenuBar* menubar = static_cast<FGPUIMenuBar*>(gui->getMenuBar());
|
FGPUIMenuBar* menubar = static_cast<FGPUIMenuBar*>(gui->getMenuBar());
|
||||||
|
|
|
@ -92,14 +92,14 @@ public:
|
||||||
func(f),
|
func(f),
|
||||||
object(obj)
|
object(obj)
|
||||||
{
|
{
|
||||||
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
auto sys = globals->get_subsystem<FGNasalSys>();
|
||||||
_gcKeys[0] = sys->gcSave(f);
|
_gcKeys[0] = sys->gcSave(f);
|
||||||
_gcKeys[1] = sys->gcSave(obj);
|
_gcKeys[1] = sys->gcSave(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onFileDialogDone(FGFileDialog* instance, const SGPath& aPath) override
|
void onFileDialogDone(FGFileDialog* instance, const SGPath& aPath) override
|
||||||
{
|
{
|
||||||
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
auto sys = globals->get_subsystem<FGNasalSys>();
|
||||||
|
|
||||||
naContext ctx = naNewContext();
|
naContext ctx = naNewContext();
|
||||||
naRef args[1];
|
naRef args[1];
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
|
|
||||||
~NasalCallback()
|
~NasalCallback()
|
||||||
{
|
{
|
||||||
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
auto sys = globals->get_subsystem<FGNasalSys>();
|
||||||
if (!sys) // happens during Nasal shutdown on reset
|
if (!sys) // happens during Nasal shutdown on reset
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -328,10 +328,10 @@ struct FdmInitialisedListener : SGPropertyChangeListener
|
||||||
if (m_fdm_initialised->getBoolValue())
|
if (m_fdm_initialised->getBoolValue())
|
||||||
{
|
{
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Getting property associations from FDM");
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Getting property associations from FDM");
|
||||||
Highlight* highlight = globals->get_subsystem<Highlight>();
|
auto highlight = globals->get_subsystem<Highlight>();
|
||||||
if (highlight)
|
if (highlight)
|
||||||
{
|
{
|
||||||
FDMShell* fdmshell = (FDMShell*) globals->get_subsystem("flight");
|
auto fdmshell = globals->get_subsystem<FDMShell>();
|
||||||
FGInterface* fginterface = fdmshell->getInterface();
|
FGInterface* fginterface = fdmshell->getInterface();
|
||||||
assert(fginterface);
|
assert(fginterface);
|
||||||
fginterface->property_associations(
|
fginterface->property_associations(
|
||||||
|
|
|
@ -464,7 +464,7 @@ const int SHOW_DETAIL2_ZOOM = 5;
|
||||||
MapWidget::MapWidget(int x, int y, int maxX, int maxY) :
|
MapWidget::MapWidget(int x, int y, int maxX, int maxY) :
|
||||||
puObject(x,y,maxX, maxY)
|
puObject(x,y,maxX, maxY)
|
||||||
{
|
{
|
||||||
_route = static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"));
|
_route = globals->get_subsystem<FGRouteMgr>();
|
||||||
_gps = fgGetNode("/instrumentation/gps");
|
_gps = fgGetNode("/instrumentation/gps");
|
||||||
|
|
||||||
_width = maxX - x;
|
_width = maxX - x;
|
||||||
|
@ -687,7 +687,7 @@ void MapWidget::update()
|
||||||
// symbols.
|
// symbols.
|
||||||
_drawRangeNm = SGGeodesy::distanceNm(_projectionCenter, topLeft) + 10.0;
|
_drawRangeNm = SGGeodesy::distanceNm(_projectionCenter, topLeft) + 10.0;
|
||||||
|
|
||||||
FGFlightHistory* history = (FGFlightHistory*) globals->get_subsystem("history");
|
auto history = globals->get_subsystem<FGFlightHistory>();
|
||||||
if (history && _root->getBoolValue("draw-flight-history")) {
|
if (history && _root->getBoolValue("draw-flight-history")) {
|
||||||
_flightHistoryPath = history->pathForHistory();
|
_flightHistoryPath = history->pathForHistory();
|
||||||
} else {
|
} else {
|
||||||
|
@ -2038,7 +2038,7 @@ MapWidget::DrawAIObject::DrawAIObject(SGPropertyNode* m, const SGGeod& g) :
|
||||||
// try to access the flight-plan of the aircraft. There are several layers
|
// try to access the flight-plan of the aircraft. There are several layers
|
||||||
// of potential NULL-ness here, so we have to be defensive at each stage.
|
// of potential NULL-ness here, so we have to be defensive at each stage.
|
||||||
std::string originICAO, destinationICAO;
|
std::string originICAO, destinationICAO;
|
||||||
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||||
FGAIBasePtr aircraft = aiManager ? aiManager->getObjectFromProperty(model) : NULL;
|
FGAIBasePtr aircraft = aiManager ? aiManager->getObjectFromProperty(model) : NULL;
|
||||||
if (aircraft) {
|
if (aircraft) {
|
||||||
FGAIAircraft* p = static_cast<FGAIAircraft*>(aircraft.get());
|
FGAIAircraft* p = static_cast<FGAIAircraft*>(aircraft.get());
|
||||||
|
|
|
@ -158,7 +158,7 @@ MessageBoxResult modalMessageBox(const std::string& caption,
|
||||||
s += "\n( " + moreText + ")";
|
s += "\n( " + moreText + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
NewGUI* gui = globals->get_subsystem<NewGUI>();
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
if (!gui || (fgGetBool("/sim/rendering/initialized", false) == false)) {
|
if (!gui || (fgGetBool("/sim/rendering/initialized", false) == false)) {
|
||||||
SG_LOG(SG_GENERAL, SG_POPUP, s);
|
SG_LOG(SG_GENERAL, SG_POPUP, s);
|
||||||
} else {
|
} else {
|
||||||
|
@ -202,7 +202,7 @@ MessageBoxResult fatalMessageBoxWithoutExit(const std::string& caption,
|
||||||
if (fgGetBool("/sim/rendering/initialized", false) == false) {
|
if (fgGetBool("/sim/rendering/initialized", false) == false) {
|
||||||
std::cerr << s << std::endl;
|
std::cerr << s << std::endl;
|
||||||
} else {
|
} else {
|
||||||
NewGUI* _gui = (NewGUI *)globals->get_subsystem("gui");
|
auto _gui = globals->get_subsystem<NewGUI>();
|
||||||
SGPropertyNode_ptr dlg = _gui->getDialogProperties("popup");
|
SGPropertyNode_ptr dlg = _gui->getDialogProperties("popup");
|
||||||
dlg->setStringValue("text/label", s );
|
dlg->setStringValue("text/label", s );
|
||||||
_gui->showDialog("popup");
|
_gui->showDialog("popup");
|
||||||
|
|
|
@ -222,7 +222,7 @@ naRef PUICompatObject::property() const
|
||||||
if (!_value)
|
if (!_value)
|
||||||
return naNil();
|
return naNil();
|
||||||
|
|
||||||
FGNasalSys* nas = globals->get_subsystem<FGNasalSys>();
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
return nas->wrappedPropsNode(_value.get());
|
return nas->wrappedPropsNode(_value.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ naRef PUICompatObject::propertyValue(naContext ctx) const
|
||||||
|
|
||||||
naRef PUICompatObject::config() const
|
naRef PUICompatObject::config() const
|
||||||
{
|
{
|
||||||
FGNasalSys* nas = globals->get_subsystem<FGNasalSys>();
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
return nas->wrappedPropsNode(_config.get());
|
return nas->wrappedPropsNode(_config.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ PUIFileDialog::~PUIFileDialog()
|
||||||
|
|
||||||
void PUIFileDialog::exec()
|
void PUIFileDialog::exec()
|
||||||
{
|
{
|
||||||
NewGUI* gui = static_cast<NewGUI*>(globals->get_subsystem("gui"));
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
std::string name("native-file-0");
|
std::string name("native-file-0");
|
||||||
_dialogRoot = fgGetNode("/sim/gui/dialogs/" + name, true);
|
_dialogRoot = fgGetNode("/sim/gui/dialogs/" + name, true);
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void PUIFileDialog::exec()
|
||||||
|
|
||||||
void PUIFileDialog::close()
|
void PUIFileDialog::close()
|
||||||
{
|
{
|
||||||
NewGUI* gui = static_cast<NewGUI*>(globals->get_subsystem("gui"));
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
std::string name("native-file-0");
|
std::string name("native-file-0");
|
||||||
gui->closeDialog(name);
|
gui->closeDialog(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ void QtQuickFGCanvasItem::setCanvas(QString canvas)
|
||||||
_canvasName = canvas;
|
_canvasName = canvas;
|
||||||
|
|
||||||
if (!_canvasName.isEmpty()) {
|
if (!_canvasName.isEmpty()) {
|
||||||
CanvasMgr* canvasManager = globals->get_subsystem<CanvasMgr>();
|
auto canvasManager = globals->get_subsystem<CanvasMgr>();
|
||||||
_canvas = canvasManager->createCanvas("");
|
_canvas = canvasManager->createCanvas("");
|
||||||
|
|
||||||
SGPropertyNode* cprops = _canvas->getProps();
|
SGPropertyNode* cprops = _canvas->getProps();
|
||||||
|
@ -232,7 +232,7 @@ void QtQuickFGCanvasItem::initCanvasNasalModules()
|
||||||
if( !nasal )
|
if( !nasal )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FGNasalSys *nas = globals->get_subsystem<FGNasalSys>();
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
if( !nas )
|
if( !nas )
|
||||||
SG_LOG( SG_GENERAL,
|
SG_LOG( SG_GENERAL,
|
||||||
SG_ALERT,
|
SG_ALERT,
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
|
|
||||||
if (prop->getNameString() == "flightplan-changed") {
|
if (prop->getNameString() == "flightplan-changed") {
|
||||||
_fp =
|
_fp =
|
||||||
static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"))->flightPlan();
|
globals->get_subsystem<FGRouteMgr>()->flightPlan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
@ -169,7 +169,7 @@ WaypointList::WaypointList(int x, int y, int width, int height) :
|
||||||
// pretend to be a list, so fgPopup doesn't mess with our mouse events
|
// pretend to be a list, so fgPopup doesn't mess with our mouse events
|
||||||
type |= PUCLASS_LIST;
|
type |= PUCLASS_LIST;
|
||||||
flightgear::FlightPlan* fp =
|
flightgear::FlightPlan* fp =
|
||||||
static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"))->flightPlan();
|
globals->get_subsystem<FGRouteMgr>()->flightPlan();
|
||||||
setModel(new FlightPlanWaypointModel(fp));
|
setModel(new FlightPlanWaypointModel(fp));
|
||||||
setSize(width, height);
|
setSize(width, height);
|
||||||
setValue(-1);
|
setValue(-1);
|
||||||
|
|
|
@ -101,7 +101,7 @@ const __fg_gui_fn_t __fg_gui_fn[] = {
|
||||||
// and we don't want to miss any, either.)
|
// and we don't want to miss any, either.)
|
||||||
void mkDialog (const char *txt)
|
void mkDialog (const char *txt)
|
||||||
{
|
{
|
||||||
NewGUI *gui = (NewGUI *)globals->get_subsystem("gui");
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
if (!gui)
|
if (!gui)
|
||||||
return;
|
return;
|
||||||
SGPropertyNode *master = gui->getDialogProperties("message");
|
SGPropertyNode *master = gui->getDialogProperties("message");
|
||||||
|
|
|
@ -95,7 +95,7 @@ static void scanMenus()
|
||||||
sim/menubar/default/menu[]/item[]. */
|
sim/menubar/default/menu[]/item[]. */
|
||||||
SGPropertyNode* menubar = globals->get_props()->getNode("sim/menubar/default");
|
SGPropertyNode* menubar = globals->get_props()->getNode("sim/menubar/default");
|
||||||
assert(menubar);
|
assert(menubar);
|
||||||
Highlight* highlight = globals->get_subsystem<Highlight>();
|
auto highlight = globals->get_subsystem<Highlight>();
|
||||||
if (!highlight) {
|
if (!highlight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -469,7 +469,7 @@ NewGUI::readDir (const SGPath& path)
|
||||||
|
|
||||||
flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
|
flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
|
||||||
flightgear::NavDataCache::Transaction txn(cache);
|
flightgear::NavDataCache::Transaction txn(cache);
|
||||||
Highlight* highlight = globals->get_subsystem<Highlight>();
|
auto highlight = globals->get_subsystem<Highlight>();
|
||||||
for (SGPath xmlPath : dir.children(simgear::Dir::TYPE_FILE, ".xml")) {
|
for (SGPath xmlPath : dir.children(simgear::Dir::TYPE_FILE, ".xml")) {
|
||||||
|
|
||||||
SGPropertyNode_ptr props = new SGPropertyNode;
|
SGPropertyNode_ptr props = new SGPropertyNode;
|
||||||
|
|
|
@ -253,7 +253,7 @@ void FGButtonEvent::update( double dt )
|
||||||
|
|
||||||
FGInputDevice::~FGInputDevice()
|
FGInputDevice::~FGInputDevice()
|
||||||
{
|
{
|
||||||
FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
if (nas && deviceNode ) {
|
if (nas && deviceNode ) {
|
||||||
SGPropertyNode_ptr nasal = deviceNode->getNode("nasal");
|
SGPropertyNode_ptr nasal = deviceNode->getNode("nasal");
|
||||||
if( nasal ) {
|
if( nasal ) {
|
||||||
|
@ -297,7 +297,7 @@ void FGInputDevice::Configure( SGPropertyNode_ptr aDeviceNode )
|
||||||
SGPropertyNode_ptr open = nasal->getNode("open");
|
SGPropertyNode_ptr open = nasal->getNode("open");
|
||||||
if (open) {
|
if (open) {
|
||||||
const string s = open->getStringValue();
|
const string s = open->getStringValue();
|
||||||
FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
if (nas)
|
if (nas)
|
||||||
nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s.c_str(), s.length(), deviceNode );
|
nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s.c_str(), s.length(), deviceNode );
|
||||||
}
|
}
|
||||||
|
@ -535,7 +535,7 @@ bool FGReportSetting::Test()
|
||||||
|
|
||||||
std::string FGReportSetting::reportBytes(const std::string& moduleName) const
|
std::string FGReportSetting::reportBytes(const std::string& moduleName) const
|
||||||
{
|
{
|
||||||
FGNasalSys *nas = globals->get_subsystem<FGNasalSys>();
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
if (!nas) {
|
if (!nas) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ void FGJoystickInput::reinit()
|
||||||
|
|
||||||
void FGJoystickInput::postinit()
|
void FGJoystickInput::postinit()
|
||||||
{
|
{
|
||||||
FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
|
auto nasalsys = globals->get_subsystem<FGNasalSys>();
|
||||||
SGPropertyNode_ptr js_nodes = fgGetNode("/input/joysticks");
|
SGPropertyNode_ptr js_nodes = fgGetNode("/input/joysticks");
|
||||||
|
|
||||||
for (int i = 0; i < MAX_JOYSTICKS; i++) {
|
for (int i = 0; i < MAX_JOYSTICKS; i++) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ void FGKeyboardInput::postinit()
|
||||||
key_nodes = fgGetNode("/input/keyboard", true);
|
key_nodes = fgGetNode("/input/keyboard", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
|
auto nasalsys = globals->get_subsystem<FGNasalSys>();
|
||||||
PropertyList nasal = key_nodes->getChildren("nasal");
|
PropertyList nasal = key_nodes->getChildren("nasal");
|
||||||
for (unsigned int j = 0; j < nasal.size(); j++) {
|
for (unsigned int j = 0; j < nasal.size(); j++) {
|
||||||
nasal[j]->setStringValue("module", module.c_str());
|
nasal[j]->setStringValue("module", module.c_str());
|
||||||
|
|
|
@ -57,75 +57,75 @@ using std::string;
|
||||||
|
|
||||||
static bool do_kln89_msg_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_msg_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
//cout << "do_kln89_msg_pressed called!\n";
|
//cout << "do_kln89_msg_pressed called!\n";
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->MsgPressed();
|
gps->MsgPressed();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_obs_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_obs_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
//cout << "do_kln89_obs_pressed called!\n";
|
//cout << "do_kln89_obs_pressed called!\n";
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->OBSPressed();
|
gps->OBSPressed();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_alt_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_alt_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
//cout << "do_kln89_alt_pressed called!\n";
|
//cout << "do_kln89_alt_pressed called!\n";
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->AltPressed();
|
gps->AltPressed();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_nrst_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_nrst_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->NrstPressed();
|
gps->NrstPressed();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_dto_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_dto_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->DtoPressed();
|
gps->DtoPressed();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_clr_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_clr_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->ClrPressed();
|
gps->ClrPressed();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_ent_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_ent_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->EntPressed();
|
gps->EntPressed();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_crsr_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_crsr_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->CrsrPressed();
|
gps->CrsrPressed();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_knob1left1(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_knob1left1(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->Knob1Left1();
|
gps->Knob1Left1();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_knob1right1(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_knob1right1(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->Knob1Right1();
|
gps->Knob1Right1();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_knob2left1(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_knob2left1(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->Knob2Left1();
|
gps->Knob2Left1();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool do_kln89_knob2right1(const SGPropertyNode * arg, SGPropertyNode * root) {
|
static bool do_kln89_knob2right1(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
auto gps = globals->get_subsystem<KLN89>();
|
||||||
gps->Knob2Right1();
|
gps->Knob2Right1();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ ADF::init ()
|
||||||
_heading_node = fgGetNode("/orientation/heading-deg", true);
|
_heading_node = fgGetNode("/orientation/heading-deg", true);
|
||||||
|
|
||||||
// sound support (audible ident code)
|
// sound support (audible ident code)
|
||||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||||
_sgr = smgr->find("avionics", true);
|
_sgr = smgr->find("avionics", true);
|
||||||
_sgr->tie_to_listener();
|
_sgr->tie_to_listener();
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ AirspeedIndicator::init ()
|
||||||
_pressure_alt = fgGetNode(_pressure_alt_source.c_str(), true);
|
_pressure_alt = fgGetNode(_pressure_alt_source.c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_environmentManager = (FGEnvironmentMgr*) globals->get_subsystem("environment");
|
_environmentManager = globals->get_subsystem<FGEnvironmentMgr>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -133,7 +133,7 @@ void AtisSpeaker::valueChanged(SGPropertyNode * node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FGSoundManager * smgr = globals->get_subsystem<FGSoundManager>();
|
auto smgr = globals->get_subsystem<FGSoundManager>();
|
||||||
if (!smgr) {
|
if (!smgr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,7 @@ GPS::update (double delta_time_sec)
|
||||||
if (_dataValid && (_mode == "init")) {
|
if (_dataValid && (_mode == "init")) {
|
||||||
// will select LEG mode if the route is active
|
// will select LEG mode if the route is active
|
||||||
routeManagerFlightPlanChanged(nullptr);
|
routeManagerFlightPlanChanged(nullptr);
|
||||||
FGRouteMgr* routeMgr = globals->get_subsystem<FGRouteMgr>();
|
auto routeMgr = globals->get_subsystem<FGRouteMgr>();
|
||||||
|
|
||||||
if (!routeMgr || !routeMgr->isRouteActive()) {
|
if (!routeMgr || !routeMgr->isRouteActive()) {
|
||||||
// initialise in OBS mode, with waypt set to the nearest airport.
|
// initialise in OBS mode, with waypt set to the nearest airport.
|
||||||
|
@ -397,7 +397,7 @@ void GPS::routeManagerFlightPlanChanged(SGPropertyNode*)
|
||||||
}
|
}
|
||||||
|
|
||||||
SG_LOG(SG_INSTR, SG_DEBUG, "GPS saw route-manager flight-plan replaced.");
|
SG_LOG(SG_INSTR, SG_DEBUG, "GPS saw route-manager flight-plan replaced.");
|
||||||
FGRouteMgr* routeMgr = globals->get_subsystem<FGRouteMgr>();
|
auto routeMgr = globals->get_subsystem<FGRouteMgr>();
|
||||||
if (!routeMgr) {
|
if (!routeMgr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ FGKR_87::~FGKR_87() {
|
||||||
|
|
||||||
|
|
||||||
void FGKR_87::init () {
|
void FGKR_87::init () {
|
||||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||||
_sgr = smgr->find("avionics", true);
|
_sgr = smgr->find("avionics", true);
|
||||||
_sgr->tie_to_listener();
|
_sgr->tie_to_listener();
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ FGMarkerBeacon::init ()
|
||||||
if (audio_btn->getType() == simgear::props::NONE)
|
if (audio_btn->getType() == simgear::props::NONE)
|
||||||
audio_btn->setBoolValue( true );
|
audio_btn->setBoolValue( true );
|
||||||
|
|
||||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||||
if (smgr) {
|
if (smgr) {
|
||||||
_audioSampleGroup = smgr->find("avionics", true);
|
_audioSampleGroup = smgr->find("avionics", true);
|
||||||
_audioSampleGroup->tie_to_listener();
|
_audioSampleGroup->tie_to_listener();
|
||||||
|
|
|
@ -211,7 +211,7 @@ do_nasal (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_replay (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_replay (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" ));
|
auto r = globals->get_subsystem<FGReplay>();
|
||||||
return r->start();
|
return r->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ do_save (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_save_tape (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_save_tape (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
FGReplay* replay = (FGReplay*) globals->get_subsystem("replay");
|
auto replay = globals->get_subsystem<FGReplay>();
|
||||||
replay->saveTape(arg);
|
replay->saveTape(arg);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -329,7 +329,7 @@ do_save_tape (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_load_tape (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_load_tape (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
FGReplay* replay = (FGReplay*) globals->get_subsystem("replay");
|
auto replay = globals->get_subsystem<FGReplay>();
|
||||||
replay->loadTape(arg);
|
replay->loadTape(arg);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -807,7 +807,7 @@ do_property_interpolate (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_data_logging_commit (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_data_logging_commit (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
FGLogger *log = (FGLogger *)globals->get_subsystem("logger");
|
auto log = globals->get_subsystem<FGLogger>();
|
||||||
log->reinit();
|
log->reinit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -913,7 +913,7 @@ do_load_xml_to_proptree(const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_load_xml_from_url(const SGPropertyNode * arg, SGPropertyNode * root)
|
do_load_xml_from_url(const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
FGHTTPClient* http = static_cast<FGHTTPClient*>(globals->get_subsystem("http"));
|
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||||
if (!http) {
|
if (!http) {
|
||||||
SG_LOG(SG_IO, SG_ALERT, "xmlhttprequest: HTTP client not running");
|
SG_LOG(SG_IO, SG_ALERT, "xmlhttprequest: HTTP client not running");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ void fgCreateSubsystems(bool duringReset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// may exist already due to GUI startup or --load-tape=http...
|
// may exist already due to GUI startup or --load-tape=http...
|
||||||
if (!globals->get_subsystem<FGHTTPClient>()) {
|
if (!mgr->get_subsystem<FGHTTPClient>()) {
|
||||||
mgr->add<FGHTTPClient>();
|
mgr->add<FGHTTPClient>();
|
||||||
}
|
}
|
||||||
mgr->add<FGDNSClient>();
|
mgr->add<FGDNSClient>();
|
||||||
|
@ -1079,7 +1079,7 @@ void fgCreateSubsystems(bool duringReset) {
|
||||||
// properties before it is initialised. This caused problems when
|
// properties before it is initialised. This caused problems when
|
||||||
// FGReplay was changed to be POST_FDM.
|
// FGReplay was changed to be POST_FDM.
|
||||||
mgr->add<FGReplay>();
|
mgr->add<FGReplay>();
|
||||||
mgr->get_subsystem("replay")->init(); // Special case.
|
mgr->get_subsystem<FGReplay>()->init(); // Special case.
|
||||||
|
|
||||||
//mgr->add<FGAIManager>();
|
//mgr->add<FGAIManager>();
|
||||||
mgr->add<FGSubmodelMgr>();
|
mgr->add<FGSubmodelMgr>();
|
||||||
|
@ -1194,23 +1194,26 @@ void fgStartReposition()
|
||||||
fgSetBool("/sim/signals/reinit", true);
|
fgSetBool("/sim/signals/reinit", true);
|
||||||
fgSetBool("/sim/crashed", false);
|
fgSetBool("/sim/crashed", false);
|
||||||
|
|
||||||
globals->get_subsystem("flight")->unbind();
|
// Fetch the subsystem manager.
|
||||||
|
auto mgr = globals->get_subsystem_mgr();
|
||||||
|
|
||||||
|
mgr->get_subsystem<FDMShell>()->unbind();
|
||||||
|
|
||||||
// update our position based on current presets
|
// update our position based on current presets
|
||||||
// this will mark position as needed finalized which we'll do in the
|
// this will mark position as needed finalized which we'll do in the
|
||||||
// main-loop
|
// main-loop
|
||||||
flightgear::initPosition();
|
flightgear::initPosition();
|
||||||
|
|
||||||
auto terraSync = globals->get_subsystem<simgear::SGTerraSync>();
|
auto terraSync = mgr->get_subsystem<simgear::SGTerraSync>();
|
||||||
if (terraSync) {
|
if (terraSync) {
|
||||||
terraSync->reposition();
|
terraSync->reposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the FDM
|
// Initialize the FDM
|
||||||
globals->get_subsystem<FDMShell>()->reinit();
|
mgr->get_subsystem<FDMShell>()->reinit();
|
||||||
|
|
||||||
// reset replay buffers
|
// reset replay buffers
|
||||||
globals->get_subsystem<FGReplay>()->reinit();
|
mgr->get_subsystem<FGReplay>()->reinit();
|
||||||
|
|
||||||
// ugly: finalizePosition waits for METAR to arrive for the new airport.
|
// ugly: finalizePosition waits for METAR to arrive for the new airport.
|
||||||
// we don't re-init the environment manager here, since historically we did
|
// we don't re-init the environment manager here, since historically we did
|
||||||
|
@ -1218,28 +1221,28 @@ void fgStartReposition()
|
||||||
// schedule METAR fetch immediately, so it's available for finalizePosition.
|
// schedule METAR fetch immediately, so it's available for finalizePosition.
|
||||||
// So we manually extract the METAR-fetching component inside the environment
|
// So we manually extract the METAR-fetching component inside the environment
|
||||||
// manager, and re-init that.
|
// manager, and re-init that.
|
||||||
SGSubsystemGroup* envMgr = static_cast<SGSubsystemGroup*>(globals->get_subsystem("environment"));
|
auto envMgr = static_cast<SGSubsystemGroup*>(mgr->get_subsystem<FGEnvironmentMgr>());
|
||||||
if (envMgr) {
|
if (envMgr) {
|
||||||
envMgr->get_subsystem("realwx")->reinit();
|
envMgr->get_subsystem("realwx")->reinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// needed for parking assignment to work after reposition
|
// needed for parking assignment to work after reposition
|
||||||
auto atcManager = globals->get_subsystem<FGATCManager>();
|
auto atcManager = mgr->get_subsystem<FGATCManager>();
|
||||||
if (atcManager) {
|
if (atcManager) {
|
||||||
atcManager->reposition();
|
atcManager->reposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to bind FDMshell again
|
// need to bind FDMshell again
|
||||||
globals->get_subsystem("flight")->bind();
|
mgr->get_subsystem<FDMShell>()->bind();
|
||||||
|
|
||||||
// need to reset aircraft (systems/instruments/autopilot)
|
// need to reset aircraft (systems/instruments/autopilot)
|
||||||
// so they can adapt to current environment
|
// so they can adapt to current environment
|
||||||
globals->get_subsystem("systems")->reinit();
|
mgr->get_subsystem<FGSystemMgr>()->reinit();
|
||||||
globals->get_subsystem("instrumentation")->reinit();
|
mgr->get_subsystem<FGInstrumentMgr>()->reinit();
|
||||||
globals->get_subsystem("xml-autopilot")->reinit();
|
mgr->get_subsystem("xml-autopilot")->reinit();
|
||||||
|
|
||||||
// need to update the timezone
|
// need to update the timezone
|
||||||
auto timeManager = globals->get_subsystem<TimeManager>();
|
auto timeManager = mgr->get_subsystem<TimeManager>();
|
||||||
if (timeManager) {
|
if (timeManager) {
|
||||||
timeManager->reposition();
|
timeManager->reposition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ do_tile_cache_reload (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
master_freeze->setBoolValue(true);
|
master_freeze->setBoolValue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
globals->get_subsystem("scenery")->reinit();
|
globals->get_subsystem<FGScenery>()->reinit();
|
||||||
|
|
||||||
if ( !freeze ) {
|
if ( !freeze ) {
|
||||||
master_freeze->setBoolValue(false);
|
master_freeze->setBoolValue(false);
|
||||||
|
@ -284,7 +284,7 @@ do_materials_reload (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_dialog_new (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_dialog_new (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
if (!gui) {
|
if (!gui) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ do_dialog_apply (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_gui_redraw (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_gui_redraw (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
auto gui = globals->get_subsystem<NewGUI>();
|
||||||
gui->redraw();
|
gui->redraw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -947,12 +947,12 @@ void FGGlobals::set_warp_delta( long int d )
|
||||||
|
|
||||||
FGScenery* FGGlobals::get_scenery () const
|
FGScenery* FGGlobals::get_scenery () const
|
||||||
{
|
{
|
||||||
return get_subsystem<FGScenery>();
|
return subsystem_mgr->get_subsystem<FGScenery>();
|
||||||
}
|
}
|
||||||
|
|
||||||
FGViewMgr *FGGlobals::get_viewmgr() const
|
FGViewMgr *FGGlobals::get_viewmgr() const
|
||||||
{
|
{
|
||||||
return get_subsystem<FGViewMgr>();
|
return subsystem_mgr->get_subsystem<FGViewMgr>();
|
||||||
}
|
}
|
||||||
|
|
||||||
flightgear::View* FGGlobals::get_current_view () const
|
flightgear::View* FGGlobals::get_current_view () const
|
||||||
|
@ -968,7 +968,7 @@ void FGGlobals::set_matlib( SGMaterialLib *m )
|
||||||
|
|
||||||
FGControls *FGGlobals::get_controls() const
|
FGControls *FGGlobals::get_controls() const
|
||||||
{
|
{
|
||||||
return get_subsystem<FGControls>();
|
return subsystem_mgr->get_subsystem<FGControls>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGGlobals::addListenerToCleanup(SGPropertyChangeListener* l)
|
void FGGlobals::addListenerToCleanup(SGPropertyChangeListener* l)
|
||||||
|
|
|
@ -161,6 +161,8 @@ private:
|
||||||
|
|
||||||
SGSharedPtr<simgear::pkg::Root> _packageRoot;
|
SGSharedPtr<simgear::pkg::Root> _packageRoot;
|
||||||
|
|
||||||
|
SGSubsystem *get_subsystem (const char * name) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGGlobals();
|
FGGlobals();
|
||||||
|
@ -171,8 +173,6 @@ public:
|
||||||
|
|
||||||
SGSubsystemMgr *get_subsystem_mgr () const;
|
SGSubsystemMgr *get_subsystem_mgr () const;
|
||||||
|
|
||||||
SGSubsystem *get_subsystem (const char * name) const;
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T* get_subsystem() const
|
T* get_subsystem() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -152,14 +152,16 @@ static void fgMainLoop( void )
|
||||||
|
|
||||||
frame_signal->fireValueChanged();
|
frame_signal->fireValueChanged();
|
||||||
|
|
||||||
auto timeManager = globals->get_subsystem<TimeManager>();
|
// Fetch the subsystem manager.
|
||||||
|
auto mgr = globals->get_subsystem_mgr();
|
||||||
|
|
||||||
// compute simulated time (allowing for pause, warp, etc) and
|
// compute simulated time (allowing for pause, warp, etc) and
|
||||||
// real elapsed time
|
// real elapsed time
|
||||||
double sim_dt, real_dt;
|
double sim_dt, real_dt;
|
||||||
timeManager->computeTimeDeltas(sim_dt, real_dt);
|
mgr->get_subsystem<TimeManager>()->computeTimeDeltas(sim_dt, real_dt);
|
||||||
|
|
||||||
// update all subsystems
|
// update all subsystems
|
||||||
globals->get_subsystem_mgr()->update(sim_dt);
|
mgr->update(sim_dt);
|
||||||
|
|
||||||
// flush commands waiting in the queue
|
// flush commands waiting in the queue
|
||||||
SGCommandMgr::instance()->executedQueuedCommands();
|
SGCommandMgr::instance()->executedQueuedCommands();
|
||||||
|
@ -312,6 +314,9 @@ static void fgIdleFunction ( void ) {
|
||||||
// our initializations out of the idle callback so that we can get a
|
// our initializations out of the idle callback so that we can get a
|
||||||
// splash screen up and running right away.
|
// splash screen up and running right away.
|
||||||
|
|
||||||
|
// Fetch the subsystem manager.
|
||||||
|
auto mgr = globals->get_subsystem_mgr();
|
||||||
|
|
||||||
if ( idle_state == 0 ) {
|
if ( idle_state == 0 ) {
|
||||||
auto camera = flightgear::getGUICamera(flightgear::CameraGroup::getDefault());
|
auto camera = flightgear::getGUICamera(flightgear::CameraGroup::getDefault());
|
||||||
if (guiInit(camera->getGraphicsContext())) {
|
if (guiInit(camera->getGraphicsContext())) {
|
||||||
|
@ -337,7 +342,7 @@ static void fgIdleFunction ( void ) {
|
||||||
} else if ( idle_state == 4 ) {
|
} else if ( idle_state == 4 ) {
|
||||||
idle_state++;
|
idle_state++;
|
||||||
|
|
||||||
globals->get_subsystem_mgr()->add<TimeManager>();
|
mgr->add<TimeManager>();
|
||||||
|
|
||||||
// Do some quick general initializations
|
// Do some quick general initializations
|
||||||
if( !fgInitGeneral()) {
|
if( !fgInitGeneral()) {
|
||||||
|
@ -367,14 +372,14 @@ static void fgIdleFunction ( void ) {
|
||||||
|
|
||||||
simgear::SGModelLib::init(globals->get_fg_root().utf8Str(), globals->get_props());
|
simgear::SGModelLib::init(globals->get_fg_root().utf8Str(), globals->get_props());
|
||||||
|
|
||||||
auto timeManager = globals->get_subsystem<TimeManager>();
|
auto timeManager = mgr->get_subsystem<TimeManager>();
|
||||||
timeManager->init();
|
timeManager->init();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Initialize the TG scenery subsystem.
|
// Initialize the TG scenery subsystem.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
auto scenery = globals->get_subsystem_mgr()->add<FGScenery>();
|
auto scenery = mgr->add<FGScenery>();
|
||||||
scenery->init();
|
scenery->init();
|
||||||
scenery->bind();
|
scenery->bind();
|
||||||
|
|
||||||
|
@ -401,12 +406,12 @@ static void fgIdleFunction ( void ) {
|
||||||
idle_state++;
|
idle_state++;
|
||||||
SGTimeStamp st;
|
SGTimeStamp st;
|
||||||
st.stamp();
|
st.stamp();
|
||||||
globals->get_subsystem_mgr()->bind();
|
mgr->bind();
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Binding subsystems took:" << st.elapsedMSec());
|
SG_LOG(SG_GENERAL, SG_INFO, "Binding subsystems took:" << st.elapsedMSec());
|
||||||
|
|
||||||
fgSplashProgress("init-subsystems");
|
fgSplashProgress("init-subsystems");
|
||||||
} else if ( idle_state == 9 ) {
|
} else if ( idle_state == 9 ) {
|
||||||
SGSubsystem::InitStatus status = globals->get_subsystem_mgr()->incrementalInit();
|
SGSubsystem::InitStatus status = mgr->incrementalInit();
|
||||||
if ( status == SGSubsystem::INIT_DONE) {
|
if ( status == SGSubsystem::INIT_DONE) {
|
||||||
++idle_state;
|
++idle_state;
|
||||||
fgSplashProgress("finishing-subsystems");
|
fgSplashProgress("finishing-subsystems");
|
||||||
|
|
|
@ -1628,7 +1628,7 @@ fgOptLoadTape(const char* arg)
|
||||||
fgGetNode("/sim/signals/fdm-initialized", true)->removeChangeListener( this );
|
fgGetNode("/sim/signals/fdm-initialized", true)->removeChangeListener( this );
|
||||||
|
|
||||||
// tell the replay subsystem to load the tape
|
// tell the replay subsystem to load the tape
|
||||||
FGReplay* replay = globals->get_subsystem<FGReplay>();
|
auto replay = globals->get_subsystem<FGReplay>();
|
||||||
assert(replay);
|
assert(replay);
|
||||||
SGPropertyNode_ptr arg = new SGPropertyNode();
|
SGPropertyNode_ptr arg = new SGPropertyNode();
|
||||||
arg->setStringValue("tape", _tape.utf8Str() );
|
arg->setStringValue("tape", _tape.utf8Str() );
|
||||||
|
|
|
@ -243,7 +243,7 @@ do_reinit (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
} else {
|
} else {
|
||||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||||
std::string name = subsystems[i]->getStringValue();
|
std::string name = subsystems[i]->getStringValue();
|
||||||
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
SGSubsystem * subsystem = globals->get_subsystem_mgr()->get_subsystem(name.c_str());
|
||||||
if (subsystem == 0) {
|
if (subsystem == 0) {
|
||||||
result = false;
|
result = false;
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
|
@ -272,7 +272,7 @@ do_suspend (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
||||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||||
std::string name = subsystems[i]->getStringValue();
|
std::string name = subsystems[i]->getStringValue();
|
||||||
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
SGSubsystem * subsystem = globals->get_subsystem_mgr()->get_subsystem(name.c_str());
|
||||||
if (subsystem == 0) {
|
if (subsystem == 0) {
|
||||||
result = false;
|
result = false;
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
|
||||||
|
@ -296,7 +296,7 @@ do_resume (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
||||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||||
std::string name = subsystems[i]->getStringValue();
|
std::string name = subsystems[i]->getStringValue();
|
||||||
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
SGSubsystem * subsystem = globals->get_subsystem_mgr()->get_subsystem(name.c_str());
|
||||||
if (subsystem == 0) {
|
if (subsystem == 0) {
|
||||||
result = false;
|
result = false;
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
INIT, LOADING_SRV_RECORDS, LOAD_NEXT_TXT_RECORD, LOADING_TXT_RECORDS, DONE,
|
INIT, LOADING_SRV_RECORDS, LOAD_NEXT_TXT_RECORD, LOADING_TXT_RECORDS, DONE,
|
||||||
} _state = INIT;
|
} _state = INIT;
|
||||||
|
|
||||||
FGDNSClient * _dnsClient = globals->get_subsystem<FGDNSClient> ();
|
FGDNSClient* _dnsClient = globals->get_subsystem<FGDNSClient>();
|
||||||
DNS::Request_ptr _dnsRequest;
|
DNS::Request_ptr _dnsRequest;
|
||||||
PropertyList _serverNodes;
|
PropertyList _serverNodes;
|
||||||
PropertyList::const_iterator _serverNodes_it;
|
PropertyList::const_iterator _serverNodes_it;
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "multiplaymgr.hxx"
|
#include "multiplaymgr.hxx"
|
||||||
#include "mpmessages.hxx"
|
#include "mpmessages.hxx"
|
||||||
#include "MPServerResolver.hxx"
|
#include "MPServerResolver.hxx"
|
||||||
|
#include <FDM/fdm_shell.hxx>
|
||||||
#include <FDM/flightProperties.hxx>
|
#include <FDM/flightProperties.hxx>
|
||||||
#include <Time/TimeManager.hxx>
|
#include <Time/TimeManager.hxx>
|
||||||
#include <Main/sentryIntegration.hxx>
|
#include <Main/sentryIntegration.hxx>
|
||||||
|
@ -2142,7 +2143,7 @@ void FGMultiplayMgr::Send(double mpTime)
|
||||||
// The orientation of the vehicle wrt the earth centered frame
|
// The orientation of the vehicle wrt the earth centered frame
|
||||||
motionInfo.orientation = qEc2Hl*hlOr;
|
motionInfo.orientation = qEc2Hl*hlOr;
|
||||||
|
|
||||||
if (!globals->get_subsystem("flight")->is_suspended()) {
|
if (!globals->get_subsystem<FDMShell>()->is_suspended()) {
|
||||||
// velocities
|
// velocities
|
||||||
motionInfo.linearVel = SG_FEET_TO_METER*SGVec3f(ifce.get_uBody(),
|
motionInfo.linearVel = SG_FEET_TO_METER*SGVec3f(ifce.get_uBody(),
|
||||||
ifce.get_vBody(),
|
ifce.get_vBody(),
|
||||||
|
@ -2661,7 +2662,7 @@ FGMultiplayMgr::addMultiplayer(const std::string& callsign,
|
||||||
mp->setCallSign(callsign);
|
mp->setCallSign(callsign);
|
||||||
mMultiPlayerMap[callsign] = mp;
|
mMultiPlayerMap[callsign] = mp;
|
||||||
|
|
||||||
FGAIManager *aiMgr = (FGAIManager*)globals->get_subsystem("ai-model");
|
auto aiMgr = globals->get_subsystem<FGAIManager>();
|
||||||
if (aiMgr) {
|
if (aiMgr) {
|
||||||
aiMgr->attach(mp);
|
aiMgr->attach(mp);
|
||||||
|
|
||||||
|
|
|
@ -1528,7 +1528,7 @@ void FlightPlan::activate()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGRouteMgr* routeManager = globals->get_subsystem<FGRouteMgr>();
|
auto routeManager = globals->get_subsystem<FGRouteMgr>();
|
||||||
if (routeManager) {
|
if (routeManager) {
|
||||||
if (routeManager->flightPlan() != this) {
|
if (routeManager->flightPlan() != this) {
|
||||||
SG_LOG(SG_NAVAID, SG_DEBUG, "setting new flight-plan on route-manager");
|
SG_LOG(SG_NAVAID, SG_DEBUG, "setting new flight-plan on route-manager");
|
||||||
|
|
|
@ -219,7 +219,7 @@ bool FGATCMain::process() {
|
||||||
// functionality from the interface than the ATC hardware can
|
// functionality from the interface than the ATC hardware can
|
||||||
// directly provide.
|
// directly provide.
|
||||||
|
|
||||||
FGNasalSys *n = (FGNasalSys*)globals->get_subsystem("nasal");
|
auto n = globals->get_subsystem<FGNasalSys>();
|
||||||
bool result = n->parseAndRun( "atcsim.update()" );
|
bool result = n->parseAndRun( "atcsim.update()" );
|
||||||
if ( !result ) {
|
if ( !result ) {
|
||||||
SG_LOG( SG_NETWORK, SG_ALERT, "Nasal: atcsim.update() failed!" );
|
SG_LOG( SG_NETWORK, SG_ALERT, "Nasal: atcsim.update() failed!" );
|
||||||
|
|
|
@ -510,8 +510,7 @@ public:
|
||||||
std::string modelPath = objectInstance._model->getModelPath();
|
std::string modelPath = objectInstance._model->getModelPath();
|
||||||
if (modelPath.empty())
|
if (modelPath.empty())
|
||||||
return;
|
return;
|
||||||
FGAIManager *aiMgr;
|
auto aiMgr = globals->get_subsystem<FGAIManager>();
|
||||||
aiMgr = static_cast<FGAIManager*>(globals->get_subsystem("ai-model"));
|
|
||||||
if (!aiMgr)
|
if (!aiMgr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ void FGHTTPClient::postinit()
|
||||||
|
|
||||||
pkg::Root* packageRoot = globals->packageRoot();
|
pkg::Root* packageRoot = globals->packageRoot();
|
||||||
if (packageRoot) {
|
if (packageRoot) {
|
||||||
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
nasal::Hash nasalGlobals = nasalSys->getGlobals();
|
nasal::Hash nasalGlobals = nasalSys->getGlobals();
|
||||||
nasal::Hash nasalPkg = nasalGlobals.createHash("pkg"); // module
|
nasal::Hash nasalPkg = nasalGlobals.createHash("pkg"); // module
|
||||||
nasalPkg.set("root", packageRoot);
|
nasalPkg.set("root", packageRoot);
|
||||||
|
|
|
@ -219,8 +219,7 @@ bool FlightHistoryUriHandler::handleRequest(const HTTPRequest & request,
|
||||||
return true; // OPTIONS only needs the headers
|
return true; // OPTIONS only needs the headers
|
||||||
}
|
}
|
||||||
|
|
||||||
FGFlightHistory* history =
|
auto history = globals->get_subsystem<FGFlightHistory>();
|
||||||
static_cast<FGFlightHistory*>(globals->get_subsystem("history"));
|
|
||||||
|
|
||||||
double minEdgeLengthM = 50;
|
double minEdgeLengthM = 50;
|
||||||
string requestPath = request.Uri.substr(getUri().length());
|
string requestPath = request.Uri.substr(getUri().length());
|
||||||
|
|
|
@ -347,7 +347,7 @@ public:
|
||||||
if (NULL == osgDB::Registry::instance()->getReaderWriterForExtension(_type))
|
if (NULL == osgDB::Registry::instance()->getReaderWriterForExtension(_type))
|
||||||
throw sg_format_exception("Unsupported image type: " + type, type);
|
throw sg_format_exception("Unsupported image type: " + type, type);
|
||||||
|
|
||||||
CanvasMgr* canvas_mgr = static_cast<CanvasMgr*> (globals->get_subsystem("Canvas"));
|
auto canvas_mgr = globals->get_subsystem<CanvasMgr>();
|
||||||
if (!canvas_mgr) {
|
if (!canvas_mgr) {
|
||||||
SG_LOG(SG_NETWORK, SG_WARN, "CanvasImage:CanvasMgr not found");
|
SG_LOG(SG_NETWORK, SG_WARN, "CanvasImage:CanvasMgr not found");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -63,7 +63,7 @@ bool FGNative::open() {
|
||||||
// process work for this port
|
// process work for this port
|
||||||
bool FGNative::process()
|
bool FGNative::process()
|
||||||
{
|
{
|
||||||
FDMShell* fdm = static_cast<FDMShell*>(globals->get_subsystem("flight"));
|
auto fdm = globals->get_subsystem<FDMShell>();
|
||||||
FGInterface* fdmState = fdm->getInterface();
|
FGInterface* fdmState = fdm->getInterface();
|
||||||
if (!fdmState) {
|
if (!fdmState) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static naRef f_getHistory(const nasal::CallContext& ctx)
|
static naRef f_getHistory(const nasal::CallContext& ctx)
|
||||||
{
|
{
|
||||||
FGFlightHistory* history =
|
auto history = globals->get_subsystem<FGFlightHistory>();
|
||||||
static_cast<FGFlightHistory*>(globals->get_subsystem("history"));
|
|
||||||
if( !history )
|
if( !history )
|
||||||
ctx.runtimeError("Failed to get 'history' subsystem");
|
ctx.runtimeError("Failed to get 'history' subsystem");
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,7 @@ SGPropertyNode* from_nasal_helper(naContext c, naRef ref, SGPropertyNode**)
|
||||||
|
|
||||||
CanvasMgr& requireCanvasMgr(const nasal::ContextWrapper& ctx)
|
CanvasMgr& requireCanvasMgr(const nasal::ContextWrapper& ctx)
|
||||||
{
|
{
|
||||||
CanvasMgr* canvas_mgr =
|
auto canvas_mgr = globals->get_subsystem<CanvasMgr>();
|
||||||
static_cast<CanvasMgr*>(globals->get_subsystem("Canvas"));
|
|
||||||
if( !canvas_mgr )
|
if( !canvas_mgr )
|
||||||
ctx.runtimeError("Failed to get Canvas subsystem");
|
ctx.runtimeError("Failed to get Canvas subsystem");
|
||||||
|
|
||||||
|
@ -114,8 +113,7 @@ CanvasMgr& requireCanvasMgr(const nasal::ContextWrapper& ctx)
|
||||||
|
|
||||||
GUIMgr& requireGUIMgr(const nasal::ContextWrapper& ctx)
|
GUIMgr& requireGUIMgr(const nasal::ContextWrapper& ctx)
|
||||||
{
|
{
|
||||||
GUIMgr* mgr =
|
auto mgr = globals->get_subsystem<GUIMgr>();
|
||||||
static_cast<GUIMgr*>(globals->get_subsystem("CanvasGUI"));
|
|
||||||
if( !mgr )
|
if( !mgr )
|
||||||
ctx.runtimeError("Failed to get CanvasGUI subsystem");
|
ctx.runtimeError("Failed to get CanvasGUI subsystem");
|
||||||
|
|
||||||
|
|
|
@ -1123,7 +1123,7 @@ static naRef f_createFlightplan(naContext c, naRef me, int argc, naRef* args)
|
||||||
static naRef f_flightplan(naContext c, naRef me, int argc, naRef* args)
|
static naRef f_flightplan(naContext c, naRef me, int argc, naRef* args)
|
||||||
{
|
{
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
FGRouteMgr* rm = static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"));
|
auto rm = globals->get_subsystem<FGRouteMgr>();
|
||||||
return ghostForFlightPlan(c, rm->flightPlan());
|
return ghostForFlightPlan(c, rm->flightPlan());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef nasal::Ghost<simgear::HTTP::MemoryRequestRef> NasalMemoryRequest;
|
||||||
|
|
||||||
FGHTTPClient& requireHTTPClient(const nasal::ContextWrapper& ctx)
|
FGHTTPClient& requireHTTPClient(const nasal::ContextWrapper& ctx)
|
||||||
{
|
{
|
||||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||||
if( !http )
|
if( !http )
|
||||||
ctx.runtimeError("Failed to get HTTP subsystem");
|
ctx.runtimeError("Failed to get HTTP subsystem");
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ void FGNasalModelData::load()
|
||||||
SG_LOG(SG_NASAL, SG_DEBUG, "Loading nasal module " << _module.c_str());
|
SG_LOG(SG_NASAL, SG_DEBUG, "Loading nasal module " << _module.c_str());
|
||||||
|
|
||||||
const string s = _load ? _load->getStringValue() : "";
|
const string s = _load ? _load->getStringValue() : "";
|
||||||
FGNasalSys* nasalSys = (FGNasalSys*) globals->get_subsystem("nasal");
|
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
|
|
||||||
// Add _module_id to script local hash to allow placing canvasses on objects
|
// Add _module_id to script local hash to allow placing canvasses on objects
|
||||||
// inside the model.
|
// inside the model.
|
||||||
|
@ -138,7 +138,7 @@ void FGNasalModelData::unload()
|
||||||
if (_module.empty())
|
if (_module.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FGNasalSys* nasalSys = (FGNasalSys*) globals->get_subsystem("nasal");
|
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
if(!nasalSys) {
|
if(!nasalSys) {
|
||||||
SG_LOG(SG_NASAL, SG_WARN, "Trying to run an <unload> script "
|
SG_LOG(SG_NASAL, SG_WARN, "Trying to run an <unload> script "
|
||||||
"without Nasal subsystem present.");
|
"without Nasal subsystem present.");
|
||||||
|
@ -204,7 +204,7 @@ void FGNasalModelDataProxy::modelLoaded( const std::string& path,
|
||||||
if(!nasal)
|
if(!nasal)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FGNasalSys* nasalSys = (FGNasalSys*) globals->get_subsystem("nasal");
|
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
if(!nasalSys)
|
if(!nasalSys)
|
||||||
{
|
{
|
||||||
SG_LOG
|
SG_LOG
|
||||||
|
|
|
@ -44,7 +44,7 @@ void AudioIdent::init()
|
||||||
_timer = 0.0;
|
_timer = 0.0;
|
||||||
_ident = "";
|
_ident = "";
|
||||||
_running = false;
|
_running = false;
|
||||||
_sgr = soundManager->find("avionics", true);
|
_sgr = globals->get_subsystem<SGSoundMgr>()->find("avionics", true);
|
||||||
_sgr->tie_to_listener();
|
_sgr->tie_to_listener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ FGFLITEVoice::FGFLITEVoice(FGVoiceMgr * mgr, const SGPropertyNode_ptr node, cons
|
||||||
|
|
||||||
_synthesizer = new FLITEVoiceSynthesizer(voice.utf8Str());
|
_synthesizer = new FLITEVoiceSynthesizer(voice.utf8Str());
|
||||||
|
|
||||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||||
_sgr = smgr->find(sampleGroupRefName, true);
|
_sgr = smgr->find(sampleGroupRefName, true);
|
||||||
_sgr->tie_to_listener();
|
_sgr->tie_to_listener();
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ FGVoicePlayer::bind (SGPropertyNode *node, const char* default_dir_prefix)
|
||||||
void
|
void
|
||||||
FGVoicePlayer::init ()
|
FGVoicePlayer::init ()
|
||||||
{
|
{
|
||||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||||
_sgr = smgr->find("avionics", true);
|
_sgr = smgr->find("avionics", true);
|
||||||
_sgr->tie_to_listener();
|
_sgr->tie_to_listener();
|
||||||
speaker.update_configuration();
|
speaker.update_configuration();
|
||||||
|
|
|
@ -43,7 +43,7 @@ static bool do_timeofday (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
const std::string &offset_type = arg->getStringValue("timeofday", "noon");
|
const std::string &offset_type = arg->getStringValue("timeofday", "noon");
|
||||||
int offset = arg->getIntValue("offset", 0);
|
int offset = arg->getIntValue("offset", 0);
|
||||||
TimeManager* self = (TimeManager*) globals->get_subsystem("time");
|
auto self = globals->get_subsystem<TimeManager>();
|
||||||
if (offset_type == "real") {
|
if (offset_type == "real") {
|
||||||
// without this, setting 'real' time is a no-op, since the current
|
// without this, setting 'real' time is a no-op, since the current
|
||||||
// wrap value (orig_warp) is retained in setTimeOffset. Ick.
|
// wrap value (orig_warp) is retained in setTimeOffset. Ick.
|
||||||
|
|
|
@ -57,7 +57,7 @@ void FGTide::unbind()
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
void FGTide::update(double dt)
|
void FGTide::update(double dt)
|
||||||
{
|
{
|
||||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
auto l = globals->get_subsystem<FGLight>();
|
||||||
|
|
||||||
// Don't know where the 60 degrees offset comes from but it matches
|
// Don't know where the 60 degrees offset comes from but it matches
|
||||||
// the tides perfectly at EHAL. Something to figure out.
|
// the tides perfectly at EHAL. Something to figure out.
|
||||||
|
|
|
@ -581,7 +581,7 @@ FGScheduledFlight* FGAISchedule::findAvailableFlight (const string ¤tDesti
|
||||||
{
|
{
|
||||||
time_t now = globals->get_time_params()->get_cur_time();
|
time_t now = globals->get_time_params()->get_cur_time();
|
||||||
|
|
||||||
FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("traffic-manager");
|
auto tmgr = globals->get_subsystem<FGTrafficManager>();
|
||||||
FGScheduledFlightVecIterator fltBegin, fltEnd;
|
FGScheduledFlightVecIterator fltBegin, fltEnd;
|
||||||
fltBegin = tmgr->getFirstFlight(req);
|
fltBegin = tmgr->getFirstFlight(req);
|
||||||
fltEnd = tmgr->getLastFlight(req);
|
fltEnd = tmgr->getLastFlight(req);
|
||||||
|
|
|
@ -613,7 +613,7 @@ void FGTrafficManager::finishInit()
|
||||||
assert(doingInit);
|
assert(doingInit);
|
||||||
SG_LOG(SG_AI, SG_INFO, "finishing AI-Traffic init");
|
SG_LOG(SG_AI, SG_INFO, "finishing AI-Traffic init");
|
||||||
loadHeuristics();
|
loadHeuristics();
|
||||||
PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
|
auto perfDB = globals->get_subsystem<PerformanceDB>();
|
||||||
// Do sorting and scoring separately, to take advantage of the "homeport" variable
|
// Do sorting and scoring separately, to take advantage of the "homeport" variable
|
||||||
for (auto schedule : scheduledAircraft) {
|
for (auto schedule : scheduledAircraft) {
|
||||||
schedule->setScore();
|
schedule->setScore();
|
||||||
|
|
|
@ -178,8 +178,8 @@ public:
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
glPushClientAttrib(~0u);
|
glPushClientAttrib(~0u);
|
||||||
|
|
||||||
// HUD can be NULL
|
// HUD can be NULL
|
||||||
HUD *hud = static_cast<HUD*>(globals->get_subsystem("hud"));
|
auto hud = globals->get_subsystem<HUD>();
|
||||||
if (hud) {
|
if (hud) {
|
||||||
hud->draw(state);
|
hud->draw(state);
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ public:
|
||||||
osg::LightSource* lightSource = static_cast<osg::LightSource*>(node);
|
osg::LightSource* lightSource = static_cast<osg::LightSource*>(node);
|
||||||
osg::Light* light = lightSource->getLight();
|
osg::Light* light = lightSource->getLight();
|
||||||
|
|
||||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
auto l = globals->get_subsystem<FGLight>();
|
||||||
if (!l) {
|
if (!l) {
|
||||||
// lighting is down during re-init
|
// lighting is down during re-init
|
||||||
return;
|
return;
|
||||||
|
@ -274,7 +274,7 @@ public:
|
||||||
lightModel = static_cast<osg::LightModel*>(stateAttribute);
|
lightModel = static_cast<osg::LightModel*>(stateAttribute);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
auto l = globals->get_subsystem<FGLight>();
|
||||||
lightModel->setAmbientIntensity(toOsg(l->scene_ambient());
|
lightModel->setAmbientIntensity(toOsg(l->scene_ambient());
|
||||||
#else
|
#else
|
||||||
lightModel->setAmbientIntensity(osg::Vec4(0, 0, 0, 1));
|
lightModel->setAmbientIntensity(osg::Vec4(0, 0, 0, 1));
|
||||||
|
@ -626,7 +626,7 @@ FGRenderer::setupView( void )
|
||||||
setupRoot();
|
setupRoot();
|
||||||
|
|
||||||
// build the sky
|
// build the sky
|
||||||
Ephemeris* ephemerisSub = globals->get_subsystem<Ephemeris>();
|
auto ephemerisSub = globals->get_subsystem<Ephemeris>();
|
||||||
|
|
||||||
|
|
||||||
// The sun and moon radius are scaled down numbers of the actual
|
// The sun and moon radius are scaled down numbers of the actual
|
||||||
|
@ -817,7 +817,7 @@ FGRenderer::update( ) {
|
||||||
fgSetBool("/sim/menubar/overlap-hide", false);
|
fgSetBool("/sim/menubar/overlap-hide", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
auto l = globals->get_subsystem<FGLight>();
|
||||||
|
|
||||||
// update fog params
|
// update fog params
|
||||||
double actual_visibility;
|
double actual_visibility;
|
||||||
|
@ -895,7 +895,7 @@ FGRenderer::updateSky()
|
||||||
double altitude_m = _altitude_ft->getDoubleValue() * SG_FEET_TO_METER;
|
double altitude_m = _altitude_ft->getDoubleValue() * SG_FEET_TO_METER;
|
||||||
_sky->modify_vis( altitude_m, 0.0 /* time factor, now unused */);
|
_sky->modify_vis( altitude_m, 0.0 /* time factor, now unused */);
|
||||||
|
|
||||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
auto l = globals->get_subsystem<FGLight>();
|
||||||
|
|
||||||
// The sun and moon distances are scaled down versions of the
|
// The sun and moon distances are scaled down versions of the
|
||||||
// actual distance. See FGRenderer::setupView() for more details.
|
// actual distance. See FGRenderer::setupView() for more details.
|
||||||
|
@ -920,7 +920,7 @@ FGRenderer::updateSky()
|
||||||
scolor.moon_angle = l->get_moon_angle();
|
scolor.moon_angle = l->get_moon_angle();
|
||||||
scolor.altitude_m = altitude_m;
|
scolor.altitude_m = altitude_m;
|
||||||
|
|
||||||
Ephemeris* ephemerisSub = globals->get_subsystem<Ephemeris>();
|
auto ephemerisSub = globals->get_subsystem<Ephemeris>();
|
||||||
double delta_time_sec = _sim_delta_sec->getDoubleValue();
|
double delta_time_sec = _sim_delta_sec->getDoubleValue();
|
||||||
_sky->reposition( sstate, *ephemerisSub->data(), delta_time_sec );
|
_sky->reposition( sstate, *ephemerisSub->data(), delta_time_sec );
|
||||||
_sky->repaint( scolor, *ephemerisSub->data() );
|
_sky->repaint( scolor, *ephemerisSub->data() );
|
||||||
|
@ -1019,7 +1019,7 @@ PickList FGRenderer::pick(const osg::Vec2& windowPos)
|
||||||
|
|
||||||
// We attempt to highlight nodes until Highlight::highlight_nodes()
|
// We attempt to highlight nodes until Highlight::highlight_nodes()
|
||||||
// succeeds and returns +ve, or highlighting is disabled and it returns -1.
|
// succeeds and returns +ve, or highlighting is disabled and it returns -1.
|
||||||
Highlight* highlight = globals->get_subsystem<Highlight>();
|
auto highlight = globals->get_subsystem<Highlight>();
|
||||||
int higlight_num_props = 0;
|
int higlight_num_props = 0;
|
||||||
|
|
||||||
for (Intersections::iterator hit = intersections.begin(),
|
for (Intersections::iterator hit = intersections.begin(),
|
||||||
|
|
|
@ -61,7 +61,7 @@ void TrafficMgrTests::testParse() {
|
||||||
globals->get_subsystem_mgr()->init();
|
globals->get_subsystem_mgr()->init();
|
||||||
globals->get_subsystem_mgr()->postinit();
|
globals->get_subsystem_mgr()->postinit();
|
||||||
|
|
||||||
FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("traffic-manager");
|
auto tmgr = globals->get_subsystem<FGTrafficManager>();
|
||||||
FGScheduledFlightVecIterator fltBegin, fltEnd;
|
FGScheduledFlightVecIterator fltBegin, fltEnd;
|
||||||
|
|
||||||
for (size_t i = 0; i < 1000000; i++)
|
for (size_t i = 0; i < 1000000; i++)
|
||||||
|
|
Loading…
Reference in a new issue