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:
|
||||
|
||||
<pre>
|
||||
FGNasalSys n = (FGNasalSys*)globals->get_subsystem("nasal");
|
||||
auto n = globals->get_subsystem<FGNasalSys>();
|
||||
if(! n->parseAndRun("print('This script was called from C++!')"))
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "My Nasal code failed :(");
|
||||
</pre>
|
||||
|
@ -408,7 +408,7 @@ avoids the parsing and code generation overhead for the successive
|
|||
calls.
|
||||
|
||||
<pre>
|
||||
FGNasalSys n = (FGNasalSys*)globals->get_subsystem("nasal");
|
||||
auto n = globals->get_subsystem<FGNasalSys>();
|
||||
FGNasalScript* script = n->parseScript("print('Spam!')"))
|
||||
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;
|
||||
prev_dist_to_go = 0.0;
|
||||
|
||||
PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
|
||||
auto perfDB = globals->get_subsystem<PerformanceDB>();
|
||||
|
||||
if (perfDB) {
|
||||
_performance = perfDB->getDefaultPerformance();
|
||||
} else {
|
||||
|
@ -184,7 +185,7 @@ void FGAIAircraft::unbind()
|
|||
|
||||
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) {
|
||||
_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)
|
||||
{
|
||||
const FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
||||
const auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||
if (!aiManager) {
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
_unloadScript = nasalScripts->getStringValue("unload");
|
||||
std::string loadScript = nasalScripts->getStringValue("load");
|
||||
if (!loadScript.empty()) {
|
||||
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||
std::string moduleName = "scenario_" + _internalName;
|
||||
bool ok = nasalSys->createModule(moduleName.c_str(), moduleName.c_str(),
|
||||
loadScript.c_str(), loadScript.size(),
|
||||
|
@ -94,7 +94,7 @@ public:
|
|||
[](FGAIBasePtr ai) { ai->setDie(true); });
|
||||
|
||||
|
||||
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||
if (!nasalSys) // happens during shutdown / reset
|
||||
return;
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ bool FGGroundController::checkTransmissionState(int minState, int maxState, Traf
|
|||
trans_num->setIntValue(-1);
|
||||
// PopupCallback(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);
|
||||
} else {
|
||||
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);
|
||||
destination = _routeManagerDestinationAirportNode->getStringValue();
|
||||
|
||||
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
||||
auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||
auto userAircraft = aiManager->getUserAircraft();
|
||||
string callsign = userAircraft->getCallSign();
|
||||
|
||||
|
@ -257,7 +257,7 @@ void FGATCManager::reposition()
|
|||
|
||||
// remove any parking assignment form the user flight-plan, so it's
|
||||
// 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();
|
||||
if (userAircraft) {
|
||||
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);
|
||||
|
||||
// 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();
|
||||
FGAIFlightPlan *fp = user_ai_ac->GetFlightPlan();
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ void Addon::setAddonNode(SGPropertyNode* addonNode)
|
|||
|
||||
naRef Addon::getAddonPropsNode() const
|
||||
{
|
||||
FGNasalSys* nas = globals->get_subsystem<FGNasalSys>();
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
return nas->wrappedPropsNode(_addonNode.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ FGAirportDynamicsRef AirportDynamicsManager::find(const std::string &icao)
|
|||
if (icao.empty())
|
||||
return FGAirportDynamicsRef();
|
||||
|
||||
AirportDynamicsManager* instance = globals->get_subsystem<AirportDynamicsManager>();
|
||||
auto instance = globals->get_subsystem<AirportDynamicsManager>();
|
||||
if (!instance)
|
||||
return FGAirportDynamicsRef();
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ private:
|
|||
void populate()
|
||||
{
|
||||
SGVec3d cartAirportPos = m_airport->cart();
|
||||
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
||||
auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||
for (auto ai : aiManager->get_ai_list()) {
|
||||
const auto cart = ai->getCartPos();
|
||||
|
||||
|
@ -714,7 +714,7 @@ bool FGAirportDynamics::innerGetActiveRunway(const string & trafficType,
|
|||
/*
|
||||
FGEnvironment
|
||||
stationweather =
|
||||
((FGEnvironmentMgr *) globals->get_subsystem("environment"))
|
||||
globals->get_subsystem<FGEnvironmentMgr>()
|
||||
->getEnvironment(getLatitude(), getLongitude(),
|
||||
getElevation());
|
||||
*/
|
||||
|
|
|
@ -925,7 +925,7 @@ bool DigitalFilter::configure( SGPropertyNode& prop_root,
|
|||
_implementation->collectDependentProperties(inputs);
|
||||
collectDependentProperties(inputs);
|
||||
|
||||
Highlight* highlight = globals->get_subsystem<Highlight>();
|
||||
auto highlight = globals->get_subsystem<Highlight>();
|
||||
if (highlight) {
|
||||
for (auto in: inputs) {
|
||||
for (auto& out: _output_list) {
|
||||
|
|
|
@ -59,14 +59,14 @@ namespace su = simgear::strutils;
|
|||
|
||||
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"));
|
||||
return self->loadRoute(path);
|
||||
}
|
||||
|
||||
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"));
|
||||
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 *)
|
||||
{
|
||||
FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
|
||||
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||
bool activate = arg->getBoolValue("activate", true);
|
||||
if (activate) {
|
||||
self->activate();
|
||||
|
@ -101,14 +101,14 @@ static bool commandActivateFlightPlan(const SGPropertyNode* arg, SGPropertyNode
|
|||
|
||||
static bool commandClearFlightPlan(const SGPropertyNode*, SGPropertyNode *)
|
||||
{
|
||||
FGRouteMgr* self = (FGRouteMgr*) globals->get_subsystem("route-manager");
|
||||
auto self = globals->get_subsystem<FGRouteMgr>();
|
||||
self->clearRoute();
|
||||
return true;
|
||||
}
|
||||
|
||||
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");
|
||||
if ((index < 0) || (index >= self->numLegs())) {
|
||||
return false;
|
||||
|
@ -120,7 +120,7 @@ static bool commandSetActiveWaypt(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");
|
||||
int index = arg->getIntValue("index");
|
||||
|
||||
|
@ -234,7 +234,7 @@ static bool commandInsertWaypt(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");
|
||||
self->removeLegAtIndex(index);
|
||||
return true;
|
||||
|
@ -673,7 +673,7 @@ void FGRouteMgr::update_mirror()
|
|||
{
|
||||
_routePath.reset(); // wipe this so we re-compute on next update()
|
||||
mirror->removeChildren("wp");
|
||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
FGDialog* rmDlg = gui ? gui->getDialog("route-manager") : NULL;
|
||||
|
||||
if (!_plan) {
|
||||
|
|
|
@ -109,13 +109,13 @@ namespace canvas
|
|||
SGSubsystem*
|
||||
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
|
||||
{
|
||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
||||
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||
|
||||
if( http )
|
||||
return http->client();
|
||||
|
|
|
@ -514,7 +514,7 @@ NavDisplay::init ()
|
|||
_odg = new FGODGauge;
|
||||
_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);
|
||||
_navRadio2Node = fgGetNode("/instrumentation/nav[1]", true);
|
||||
|
|
|
@ -289,7 +289,7 @@ FGPanel::draw(osg::State& state)
|
|||
state.setActiveTextureUnit(0);
|
||||
state.setClientActiveTextureUnit(0);
|
||||
|
||||
FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
|
||||
auto l = globals->get_subsystem<FGLight>();
|
||||
sgCopyVec4( panel_color, l->scene_diffuse().data());
|
||||
if ( fgGetDouble("/systems/electrical/outputs/instrument-lights") > 1.0 ) {
|
||||
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!!!
|
||||
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) {
|
||||
gps = new KLN89(instrument);
|
||||
globals->get_subsystem_mgr()->add("kln89", gps);
|
||||
|
|
|
@ -145,7 +145,7 @@ void FGClimate::reinit()
|
|||
// http://vectormap.si.edu/Climate.htm
|
||||
void FGClimate::update(double dt)
|
||||
{
|
||||
FGLight *l = globals->get_subsystem<FGLight>();
|
||||
auto l = globals->get_subsystem<FGLight>();
|
||||
if (l)
|
||||
{
|
||||
_sun_longitude_deg = l->get_sun_lon()*SGD_RADIANS_TO_DEGREES;
|
||||
|
|
|
@ -203,7 +203,7 @@ protected:
|
|||
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ static bool commandRequestMetar(const SGPropertyNode * arg, SGPropertyNode * roo
|
|||
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ void NoaaMetarRealWxController::requestMetar
|
|||
"NoaaMetarRealWxController::update(): "
|
||||
"spawning load request for station-id '" << upperId << "'"
|
||||
);
|
||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
||||
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||
if (http) {
|
||||
http->makeRequest(new NoaaMetarGetRequest(metarDataHandler, upperId, noaa_base_url));
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ CanvasWidget::CanvasWidget( int x, int y,
|
|||
if( !nasal )
|
||||
return;
|
||||
|
||||
FGNasalSys *nas = globals->get_subsystem<FGNasalSys>();
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
if( !nas )
|
||||
SG_LOG( SG_GENERAL,
|
||||
SG_ALERT,
|
||||
|
|
|
@ -201,7 +201,7 @@ void CatalogListModel::refreshCatalog(int index)
|
|||
|
||||
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());
|
||||
if (showAddFeedback) {
|
||||
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
|
||||
// to the fallback URL.
|
||||
if (cat->status() == Delegate::FAIL_NOT_FOUND) {
|
||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
||||
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||
if (cat->url() == http->getDefaultCatalogUrl()) {
|
||||
cat->setUrl(http->getDefaultCatalogFallbackUrl());
|
||||
cat->refresh(); // and trigger another refresh
|
||||
|
|
|
@ -476,7 +476,7 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
|
|||
obj->setBuffer(tsync->log());
|
||||
}
|
||||
} else {
|
||||
FGNasalSys* nasal = (FGNasalSys*)globals->get_subsystem("nasal");
|
||||
auto nasal = globals->get_subsystem<FGNasalSys>();
|
||||
obj->setBuffer(nasal->log());
|
||||
}
|
||||
|
||||
|
|
|
@ -576,7 +576,7 @@ static void
|
|||
action_callback(puObject* object)
|
||||
{
|
||||
GUIInfo* info = (GUIInfo*)object->getUserData();
|
||||
NewGUI* gui = (NewGUI*)globals->get_subsystem("gui");
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
gui->setActiveDialog(info->dialog);
|
||||
int nBindings = info->bindings.size();
|
||||
for (int i = 0; i < nBindings; i++) {
|
||||
|
@ -1087,7 +1087,7 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
|
|||
obj->setBuffer(tsync->log());
|
||||
}
|
||||
} else {
|
||||
FGNasalSys* nasal = (FGNasalSys*)globals->get_subsystem("nasal");
|
||||
auto nasal = globals->get_subsystem<FGNasalSys>();
|
||||
obj->setBuffer(nasal->log());
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ add_deprecated_dialogs ()
|
|||
static void
|
||||
menu_callback (puObject * object)
|
||||
{
|
||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
FGPUIMenuBar* mb = static_cast<FGPUIMenuBar*>(gui->getMenuBar());
|
||||
mb->fireItem(object);
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ namespace {
|
|||
|
||||
struct EnabledListener : SGPropertyChangeListener {
|
||||
void valueChanged(SGPropertyNode *node) {
|
||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
if (!gui)
|
||||
return;
|
||||
FGPUIMenuBar* menubar = static_cast<FGPUIMenuBar*>(gui->getMenuBar());
|
||||
|
|
|
@ -92,14 +92,14 @@ public:
|
|||
func(f),
|
||||
object(obj)
|
||||
{
|
||||
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
||||
auto sys = globals->get_subsystem<FGNasalSys>();
|
||||
_gcKeys[0] = sys->gcSave(f);
|
||||
_gcKeys[1] = sys->gcSave(obj);
|
||||
}
|
||||
|
||||
void onFileDialogDone(FGFileDialog* instance, const SGPath& aPath) override
|
||||
{
|
||||
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
||||
auto sys = globals->get_subsystem<FGNasalSys>();
|
||||
|
||||
naContext ctx = naNewContext();
|
||||
naRef args[1];
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
|
||||
~NasalCallback()
|
||||
{
|
||||
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
||||
auto sys = globals->get_subsystem<FGNasalSys>();
|
||||
if (!sys) // happens during Nasal shutdown on reset
|
||||
return;
|
||||
|
||||
|
|
|
@ -328,10 +328,10 @@ struct FdmInitialisedListener : SGPropertyChangeListener
|
|||
if (m_fdm_initialised->getBoolValue())
|
||||
{
|
||||
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)
|
||||
{
|
||||
FDMShell* fdmshell = (FDMShell*) globals->get_subsystem("flight");
|
||||
auto fdmshell = globals->get_subsystem<FDMShell>();
|
||||
FGInterface* fginterface = fdmshell->getInterface();
|
||||
assert(fginterface);
|
||||
fginterface->property_associations(
|
||||
|
|
|
@ -464,7 +464,7 @@ const int SHOW_DETAIL2_ZOOM = 5;
|
|||
MapWidget::MapWidget(int x, int y, int maxX, int maxY) :
|
||||
puObject(x,y,maxX, maxY)
|
||||
{
|
||||
_route = static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"));
|
||||
_route = globals->get_subsystem<FGRouteMgr>();
|
||||
_gps = fgGetNode("/instrumentation/gps");
|
||||
|
||||
_width = maxX - x;
|
||||
|
@ -687,7 +687,7 @@ void MapWidget::update()
|
|||
// symbols.
|
||||
_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")) {
|
||||
_flightHistoryPath = history->pathForHistory();
|
||||
} 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
|
||||
// of potential NULL-ness here, so we have to be defensive at each stage.
|
||||
std::string originICAO, destinationICAO;
|
||||
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
|
||||
auto aiManager = globals->get_subsystem<FGAIManager>();
|
||||
FGAIBasePtr aircraft = aiManager ? aiManager->getObjectFromProperty(model) : NULL;
|
||||
if (aircraft) {
|
||||
FGAIAircraft* p = static_cast<FGAIAircraft*>(aircraft.get());
|
||||
|
|
|
@ -158,7 +158,7 @@ MessageBoxResult modalMessageBox(const std::string& caption,
|
|||
s += "\n( " + moreText + ")";
|
||||
}
|
||||
|
||||
NewGUI* gui = globals->get_subsystem<NewGUI>();
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
if (!gui || (fgGetBool("/sim/rendering/initialized", false) == false)) {
|
||||
SG_LOG(SG_GENERAL, SG_POPUP, s);
|
||||
} else {
|
||||
|
@ -202,7 +202,7 @@ MessageBoxResult fatalMessageBoxWithoutExit(const std::string& caption,
|
|||
if (fgGetBool("/sim/rendering/initialized", false) == false) {
|
||||
std::cerr << s << std::endl;
|
||||
} else {
|
||||
NewGUI* _gui = (NewGUI *)globals->get_subsystem("gui");
|
||||
auto _gui = globals->get_subsystem<NewGUI>();
|
||||
SGPropertyNode_ptr dlg = _gui->getDialogProperties("popup");
|
||||
dlg->setStringValue("text/label", s );
|
||||
_gui->showDialog("popup");
|
||||
|
|
|
@ -222,7 +222,7 @@ naRef PUICompatObject::property() const
|
|||
if (!_value)
|
||||
return naNil();
|
||||
|
||||
FGNasalSys* nas = globals->get_subsystem<FGNasalSys>();
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
return nas->wrappedPropsNode(_value.get());
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ naRef PUICompatObject::propertyValue(naContext ctx) const
|
|||
|
||||
naRef PUICompatObject::config() const
|
||||
{
|
||||
FGNasalSys* nas = globals->get_subsystem<FGNasalSys>();
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
return nas->wrappedPropsNode(_config.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ PUIFileDialog::~PUIFileDialog()
|
|||
|
||||
void PUIFileDialog::exec()
|
||||
{
|
||||
NewGUI* gui = static_cast<NewGUI*>(globals->get_subsystem("gui"));
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
std::string name("native-file-0");
|
||||
_dialogRoot = fgGetNode("/sim/gui/dialogs/" + name, true);
|
||||
|
||||
|
@ -80,7 +80,7 @@ void PUIFileDialog::exec()
|
|||
|
||||
void PUIFileDialog::close()
|
||||
{
|
||||
NewGUI* gui = static_cast<NewGUI*>(globals->get_subsystem("gui"));
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
std::string name("native-file-0");
|
||||
gui->closeDialog(name);
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ void QtQuickFGCanvasItem::setCanvas(QString canvas)
|
|||
_canvasName = canvas;
|
||||
|
||||
if (!_canvasName.isEmpty()) {
|
||||
CanvasMgr* canvasManager = globals->get_subsystem<CanvasMgr>();
|
||||
auto canvasManager = globals->get_subsystem<CanvasMgr>();
|
||||
_canvas = canvasManager->createCanvas("");
|
||||
|
||||
SGPropertyNode* cprops = _canvas->getProps();
|
||||
|
@ -232,7 +232,7 @@ void QtQuickFGCanvasItem::initCanvasNasalModules()
|
|||
if( !nasal )
|
||||
return;
|
||||
|
||||
FGNasalSys *nas = globals->get_subsystem<FGNasalSys>();
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
if( !nas )
|
||||
SG_LOG( SG_GENERAL,
|
||||
SG_ALERT,
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
|
||||
if (prop->getNameString() == "flightplan-changed") {
|
||||
_fp =
|
||||
static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"))->flightPlan();
|
||||
globals->get_subsystem<FGRouteMgr>()->flightPlan();
|
||||
}
|
||||
}
|
||||
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
|
||||
type |= PUCLASS_LIST;
|
||||
flightgear::FlightPlan* fp =
|
||||
static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"))->flightPlan();
|
||||
globals->get_subsystem<FGRouteMgr>()->flightPlan();
|
||||
setModel(new FlightPlanWaypointModel(fp));
|
||||
setSize(width, height);
|
||||
setValue(-1);
|
||||
|
|
|
@ -101,7 +101,7 @@ const __fg_gui_fn_t __fg_gui_fn[] = {
|
|||
// and we don't want to miss any, either.)
|
||||
void mkDialog (const char *txt)
|
||||
{
|
||||
NewGUI *gui = (NewGUI *)globals->get_subsystem("gui");
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
if (!gui)
|
||||
return;
|
||||
SGPropertyNode *master = gui->getDialogProperties("message");
|
||||
|
|
|
@ -95,7 +95,7 @@ static void scanMenus()
|
|||
sim/menubar/default/menu[]/item[]. */
|
||||
SGPropertyNode* menubar = globals->get_props()->getNode("sim/menubar/default");
|
||||
assert(menubar);
|
||||
Highlight* highlight = globals->get_subsystem<Highlight>();
|
||||
auto highlight = globals->get_subsystem<Highlight>();
|
||||
if (!highlight) {
|
||||
return;
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ NewGUI::readDir (const SGPath& path)
|
|||
|
||||
flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
|
||||
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")) {
|
||||
|
||||
SGPropertyNode_ptr props = new SGPropertyNode;
|
||||
|
|
|
@ -253,7 +253,7 @@ void FGButtonEvent::update( double dt )
|
|||
|
||||
FGInputDevice::~FGInputDevice()
|
||||
{
|
||||
FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
if (nas && deviceNode ) {
|
||||
SGPropertyNode_ptr nasal = deviceNode->getNode("nasal");
|
||||
if( nasal ) {
|
||||
|
@ -297,7 +297,7 @@ void FGInputDevice::Configure( SGPropertyNode_ptr aDeviceNode )
|
|||
SGPropertyNode_ptr open = nasal->getNode("open");
|
||||
if (open) {
|
||||
const string s = open->getStringValue();
|
||||
FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
if (nas)
|
||||
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
|
||||
{
|
||||
FGNasalSys *nas = globals->get_subsystem<FGNasalSys>();
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
if (!nas) {
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ void FGJoystickInput::reinit()
|
|||
|
||||
void FGJoystickInput::postinit()
|
||||
{
|
||||
FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
|
||||
auto nasalsys = globals->get_subsystem<FGNasalSys>();
|
||||
SGPropertyNode_ptr js_nodes = fgGetNode("/input/joysticks");
|
||||
|
||||
for (int i = 0; i < MAX_JOYSTICKS; i++) {
|
||||
|
|
|
@ -107,7 +107,7 @@ void FGKeyboardInput::postinit()
|
|||
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");
|
||||
for (unsigned int j = 0; j < nasal.size(); j++) {
|
||||
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) {
|
||||
//cout << "do_kln89_msg_pressed called!\n";
|
||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
||||
auto gps = globals->get_subsystem<KLN89>();
|
||||
gps->MsgPressed();
|
||||
return(true);
|
||||
}
|
||||
|
||||
static bool do_kln89_obs_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||
//cout << "do_kln89_obs_pressed called!\n";
|
||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
||||
auto gps = globals->get_subsystem<KLN89>();
|
||||
gps->OBSPressed();
|
||||
return(true);
|
||||
}
|
||||
|
||||
static bool do_kln89_alt_pressed(const SGPropertyNode * arg, SGPropertyNode * root) {
|
||||
//cout << "do_kln89_alt_pressed called!\n";
|
||||
KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
|
||||
auto gps = globals->get_subsystem<KLN89>();
|
||||
gps->AltPressed();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
||||
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();
|
||||
return(true);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ ADF::init ()
|
|||
_heading_node = fgGetNode("/orientation/heading-deg", true);
|
||||
|
||||
// sound support (audible ident code)
|
||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
_sgr = smgr->find("avionics", true);
|
||||
_sgr->tie_to_listener();
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ AirspeedIndicator::init ()
|
|||
_pressure_alt = fgGetNode(_pressure_alt_source.c_str(), true);
|
||||
}
|
||||
|
||||
_environmentManager = (FGEnvironmentMgr*) globals->get_subsystem("environment");
|
||||
_environmentManager = globals->get_subsystem<FGEnvironmentMgr>();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -133,7 +133,7 @@ void AtisSpeaker::valueChanged(SGPropertyNode * node)
|
|||
}
|
||||
}
|
||||
|
||||
FGSoundManager * smgr = globals->get_subsystem<FGSoundManager>();
|
||||
auto smgr = globals->get_subsystem<FGSoundManager>();
|
||||
if (!smgr) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ GPS::update (double delta_time_sec)
|
|||
if (_dataValid && (_mode == "init")) {
|
||||
// will select LEG mode if the route is active
|
||||
routeManagerFlightPlanChanged(nullptr);
|
||||
FGRouteMgr* routeMgr = globals->get_subsystem<FGRouteMgr>();
|
||||
auto routeMgr = globals->get_subsystem<FGRouteMgr>();
|
||||
|
||||
if (!routeMgr || !routeMgr->isRouteActive()) {
|
||||
// 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.");
|
||||
FGRouteMgr* routeMgr = globals->get_subsystem<FGRouteMgr>();
|
||||
auto routeMgr = globals->get_subsystem<FGRouteMgr>();
|
||||
if (!routeMgr) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ FGKR_87::~FGKR_87() {
|
|||
|
||||
|
||||
void FGKR_87::init () {
|
||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
_sgr = smgr->find("avionics", true);
|
||||
_sgr->tie_to_listener();
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ FGMarkerBeacon::init ()
|
|||
if (audio_btn->getType() == simgear::props::NONE)
|
||||
audio_btn->setBoolValue( true );
|
||||
|
||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
if (smgr) {
|
||||
_audioSampleGroup = smgr->find("avionics", true);
|
||||
_audioSampleGroup->tie_to_listener();
|
||||
|
|
|
@ -211,7 +211,7 @@ do_nasal (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
do_replay (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||
{
|
||||
FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" ));
|
||||
auto r = globals->get_subsystem<FGReplay>();
|
||||
return r->start();
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ do_save (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
do_save_tape (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||
{
|
||||
FGReplay* replay = (FGReplay*) globals->get_subsystem("replay");
|
||||
auto replay = globals->get_subsystem<FGReplay>();
|
||||
replay->saveTape(arg);
|
||||
|
||||
return true;
|
||||
|
@ -329,7 +329,7 @@ do_save_tape (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
do_load_tape (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||
{
|
||||
FGReplay* replay = (FGReplay*) globals->get_subsystem("replay");
|
||||
auto replay = globals->get_subsystem<FGReplay>();
|
||||
replay->loadTape(arg);
|
||||
|
||||
return true;
|
||||
|
@ -807,7 +807,7 @@ do_property_interpolate (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
do_data_logging_commit (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||
{
|
||||
FGLogger *log = (FGLogger *)globals->get_subsystem("logger");
|
||||
auto log = globals->get_subsystem<FGLogger>();
|
||||
log->reinit();
|
||||
return true;
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ do_load_xml_to_proptree(const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
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) {
|
||||
SG_LOG(SG_IO, SG_ALERT, "xmlhttprequest: HTTP client not running");
|
||||
return false;
|
||||
|
|
|
@ -1014,7 +1014,7 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
}
|
||||
|
||||
// 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<FGDNSClient>();
|
||||
|
@ -1079,7 +1079,7 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
// properties before it is initialised. This caused problems when
|
||||
// FGReplay was changed to be POST_FDM.
|
||||
mgr->add<FGReplay>();
|
||||
mgr->get_subsystem("replay")->init(); // Special case.
|
||||
mgr->get_subsystem<FGReplay>()->init(); // Special case.
|
||||
|
||||
//mgr->add<FGAIManager>();
|
||||
mgr->add<FGSubmodelMgr>();
|
||||
|
@ -1194,23 +1194,26 @@ void fgStartReposition()
|
|||
fgSetBool("/sim/signals/reinit", true);
|
||||
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
|
||||
// this will mark position as needed finalized which we'll do in the
|
||||
// main-loop
|
||||
flightgear::initPosition();
|
||||
|
||||
auto terraSync = globals->get_subsystem<simgear::SGTerraSync>();
|
||||
auto terraSync = mgr->get_subsystem<simgear::SGTerraSync>();
|
||||
if (terraSync) {
|
||||
terraSync->reposition();
|
||||
}
|
||||
|
||||
// Initialize the FDM
|
||||
globals->get_subsystem<FDMShell>()->reinit();
|
||||
mgr->get_subsystem<FDMShell>()->reinit();
|
||||
|
||||
// reset replay buffers
|
||||
globals->get_subsystem<FGReplay>()->reinit();
|
||||
mgr->get_subsystem<FGReplay>()->reinit();
|
||||
|
||||
// ugly: finalizePosition waits for METAR to arrive for the new airport.
|
||||
// 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.
|
||||
// So we manually extract the METAR-fetching component inside the environment
|
||||
// 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) {
|
||||
envMgr->get_subsystem("realwx")->reinit();
|
||||
}
|
||||
|
||||
// needed for parking assignment to work after reposition
|
||||
auto atcManager = globals->get_subsystem<FGATCManager>();
|
||||
auto atcManager = mgr->get_subsystem<FGATCManager>();
|
||||
if (atcManager) {
|
||||
atcManager->reposition();
|
||||
}
|
||||
|
||||
// need to bind FDMshell again
|
||||
globals->get_subsystem("flight")->bind();
|
||||
mgr->get_subsystem<FDMShell>()->bind();
|
||||
|
||||
// need to reset aircraft (systems/instruments/autopilot)
|
||||
// so they can adapt to current environment
|
||||
globals->get_subsystem("systems")->reinit();
|
||||
globals->get_subsystem("instrumentation")->reinit();
|
||||
globals->get_subsystem("xml-autopilot")->reinit();
|
||||
mgr->get_subsystem<FGSystemMgr>()->reinit();
|
||||
mgr->get_subsystem<FGInstrumentMgr>()->reinit();
|
||||
mgr->get_subsystem("xml-autopilot")->reinit();
|
||||
|
||||
// need to update the timezone
|
||||
auto timeManager = globals->get_subsystem<TimeManager>();
|
||||
auto timeManager = mgr->get_subsystem<TimeManager>();
|
||||
if (timeManager) {
|
||||
timeManager->reposition();
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ do_tile_cache_reload (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
master_freeze->setBoolValue(true);
|
||||
}
|
||||
|
||||
globals->get_subsystem("scenery")->reinit();
|
||||
globals->get_subsystem<FGScenery>()->reinit();
|
||||
|
||||
if ( !freeze ) {
|
||||
master_freeze->setBoolValue(false);
|
||||
|
@ -284,7 +284,7 @@ do_materials_reload (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
do_dialog_new (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||
{
|
||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
if (!gui) {
|
||||
return false;
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ do_dialog_apply (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
do_gui_redraw (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||
{
|
||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
||||
auto gui = globals->get_subsystem<NewGUI>();
|
||||
gui->redraw();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -947,12 +947,12 @@ void FGGlobals::set_warp_delta( long int d )
|
|||
|
||||
FGScenery* FGGlobals::get_scenery () const
|
||||
{
|
||||
return get_subsystem<FGScenery>();
|
||||
return subsystem_mgr->get_subsystem<FGScenery>();
|
||||
}
|
||||
|
||||
FGViewMgr *FGGlobals::get_viewmgr() const
|
||||
{
|
||||
return get_subsystem<FGViewMgr>();
|
||||
return subsystem_mgr->get_subsystem<FGViewMgr>();
|
||||
}
|
||||
|
||||
flightgear::View* FGGlobals::get_current_view () const
|
||||
|
@ -968,7 +968,7 @@ void FGGlobals::set_matlib( SGMaterialLib *m )
|
|||
|
||||
FGControls *FGGlobals::get_controls() const
|
||||
{
|
||||
return get_subsystem<FGControls>();
|
||||
return subsystem_mgr->get_subsystem<FGControls>();
|
||||
}
|
||||
|
||||
void FGGlobals::addListenerToCleanup(SGPropertyChangeListener* l)
|
||||
|
|
|
@ -161,6 +161,8 @@ private:
|
|||
|
||||
SGSharedPtr<simgear::pkg::Root> _packageRoot;
|
||||
|
||||
SGSubsystem *get_subsystem (const char * name) const;
|
||||
|
||||
public:
|
||||
|
||||
FGGlobals();
|
||||
|
@ -171,8 +173,6 @@ public:
|
|||
|
||||
SGSubsystemMgr *get_subsystem_mgr () const;
|
||||
|
||||
SGSubsystem *get_subsystem (const char * name) const;
|
||||
|
||||
template<class T>
|
||||
T* get_subsystem() const
|
||||
{
|
||||
|
|
|
@ -152,14 +152,16 @@ static void fgMainLoop( void )
|
|||
|
||||
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
|
||||
// real elapsed time
|
||||
double sim_dt, real_dt;
|
||||
timeManager->computeTimeDeltas(sim_dt, real_dt);
|
||||
mgr->get_subsystem<TimeManager>()->computeTimeDeltas(sim_dt, real_dt);
|
||||
|
||||
// update all subsystems
|
||||
globals->get_subsystem_mgr()->update(sim_dt);
|
||||
mgr->update(sim_dt);
|
||||
|
||||
// flush commands waiting in the queue
|
||||
SGCommandMgr::instance()->executedQueuedCommands();
|
||||
|
@ -312,6 +314,9 @@ static void fgIdleFunction ( void ) {
|
|||
// our initializations out of the idle callback so that we can get a
|
||||
// splash screen up and running right away.
|
||||
|
||||
// Fetch the subsystem manager.
|
||||
auto mgr = globals->get_subsystem_mgr();
|
||||
|
||||
if ( idle_state == 0 ) {
|
||||
auto camera = flightgear::getGUICamera(flightgear::CameraGroup::getDefault());
|
||||
if (guiInit(camera->getGraphicsContext())) {
|
||||
|
@ -337,7 +342,7 @@ static void fgIdleFunction ( void ) {
|
|||
} else if ( idle_state == 4 ) {
|
||||
idle_state++;
|
||||
|
||||
globals->get_subsystem_mgr()->add<TimeManager>();
|
||||
mgr->add<TimeManager>();
|
||||
|
||||
// Do some quick general initializations
|
||||
if( !fgInitGeneral()) {
|
||||
|
@ -367,14 +372,14 @@ static void fgIdleFunction ( void ) {
|
|||
|
||||
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();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the TG scenery subsystem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
auto scenery = globals->get_subsystem_mgr()->add<FGScenery>();
|
||||
auto scenery = mgr->add<FGScenery>();
|
||||
scenery->init();
|
||||
scenery->bind();
|
||||
|
||||
|
@ -401,12 +406,12 @@ static void fgIdleFunction ( void ) {
|
|||
idle_state++;
|
||||
SGTimeStamp st;
|
||||
st.stamp();
|
||||
globals->get_subsystem_mgr()->bind();
|
||||
mgr->bind();
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Binding subsystems took:" << st.elapsedMSec());
|
||||
|
||||
fgSplashProgress("init-subsystems");
|
||||
} else if ( idle_state == 9 ) {
|
||||
SGSubsystem::InitStatus status = globals->get_subsystem_mgr()->incrementalInit();
|
||||
SGSubsystem::InitStatus status = mgr->incrementalInit();
|
||||
if ( status == SGSubsystem::INIT_DONE) {
|
||||
++idle_state;
|
||||
fgSplashProgress("finishing-subsystems");
|
||||
|
|
|
@ -1628,7 +1628,7 @@ fgOptLoadTape(const char* arg)
|
|||
fgGetNode("/sim/signals/fdm-initialized", true)->removeChangeListener( this );
|
||||
|
||||
// tell the replay subsystem to load the tape
|
||||
FGReplay* replay = globals->get_subsystem<FGReplay>();
|
||||
auto replay = globals->get_subsystem<FGReplay>();
|
||||
assert(replay);
|
||||
SGPropertyNode_ptr arg = new SGPropertyNode();
|
||||
arg->setStringValue("tape", _tape.utf8Str() );
|
||||
|
|
|
@ -243,7 +243,7 @@ do_reinit (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
} else {
|
||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||
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) {
|
||||
result = false;
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
|
@ -272,7 +272,7 @@ do_suspend (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||
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) {
|
||||
result = false;
|
||||
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");
|
||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||
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) {
|
||||
result = false;
|
||||
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,
|
||||
} _state = INIT;
|
||||
|
||||
FGDNSClient * _dnsClient = globals->get_subsystem<FGDNSClient> ();
|
||||
FGDNSClient* _dnsClient = globals->get_subsystem<FGDNSClient>();
|
||||
DNS::Request_ptr _dnsRequest;
|
||||
PropertyList _serverNodes;
|
||||
PropertyList::const_iterator _serverNodes_it;
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "multiplaymgr.hxx"
|
||||
#include "mpmessages.hxx"
|
||||
#include "MPServerResolver.hxx"
|
||||
#include <FDM/fdm_shell.hxx>
|
||||
#include <FDM/flightProperties.hxx>
|
||||
#include <Time/TimeManager.hxx>
|
||||
#include <Main/sentryIntegration.hxx>
|
||||
|
@ -2142,7 +2143,7 @@ void FGMultiplayMgr::Send(double mpTime)
|
|||
// The orientation of the vehicle wrt the earth centered frame
|
||||
motionInfo.orientation = qEc2Hl*hlOr;
|
||||
|
||||
if (!globals->get_subsystem("flight")->is_suspended()) {
|
||||
if (!globals->get_subsystem<FDMShell>()->is_suspended()) {
|
||||
// velocities
|
||||
motionInfo.linearVel = SG_FEET_TO_METER*SGVec3f(ifce.get_uBody(),
|
||||
ifce.get_vBody(),
|
||||
|
@ -2661,7 +2662,7 @@ FGMultiplayMgr::addMultiplayer(const std::string& callsign,
|
|||
mp->setCallSign(callsign);
|
||||
mMultiPlayerMap[callsign] = mp;
|
||||
|
||||
FGAIManager *aiMgr = (FGAIManager*)globals->get_subsystem("ai-model");
|
||||
auto aiMgr = globals->get_subsystem<FGAIManager>();
|
||||
if (aiMgr) {
|
||||
aiMgr->attach(mp);
|
||||
|
||||
|
|
|
@ -1528,7 +1528,7 @@ void FlightPlan::activate()
|
|||
return;
|
||||
}
|
||||
|
||||
FGRouteMgr* routeManager = globals->get_subsystem<FGRouteMgr>();
|
||||
auto routeManager = globals->get_subsystem<FGRouteMgr>();
|
||||
if (routeManager) {
|
||||
if (routeManager->flightPlan() != this) {
|
||||
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
|
||||
// directly provide.
|
||||
|
||||
FGNasalSys *n = (FGNasalSys*)globals->get_subsystem("nasal");
|
||||
auto n = globals->get_subsystem<FGNasalSys>();
|
||||
bool result = n->parseAndRun( "atcsim.update()" );
|
||||
if ( !result ) {
|
||||
SG_LOG( SG_NETWORK, SG_ALERT, "Nasal: atcsim.update() failed!" );
|
||||
|
|
|
@ -510,8 +510,7 @@ public:
|
|||
std::string modelPath = objectInstance._model->getModelPath();
|
||||
if (modelPath.empty())
|
||||
return;
|
||||
FGAIManager *aiMgr;
|
||||
aiMgr = static_cast<FGAIManager*>(globals->get_subsystem("ai-model"));
|
||||
auto aiMgr = globals->get_subsystem<FGAIManager>();
|
||||
if (!aiMgr)
|
||||
return;
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ void FGHTTPClient::postinit()
|
|||
|
||||
pkg::Root* packageRoot = globals->packageRoot();
|
||||
if (packageRoot) {
|
||||
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||
nasal::Hash nasalGlobals = nasalSys->getGlobals();
|
||||
nasal::Hash nasalPkg = nasalGlobals.createHash("pkg"); // module
|
||||
nasalPkg.set("root", packageRoot);
|
||||
|
|
|
@ -219,8 +219,7 @@ bool FlightHistoryUriHandler::handleRequest(const HTTPRequest & request,
|
|||
return true; // OPTIONS only needs the headers
|
||||
}
|
||||
|
||||
FGFlightHistory* history =
|
||||
static_cast<FGFlightHistory*>(globals->get_subsystem("history"));
|
||||
auto history = globals->get_subsystem<FGFlightHistory>();
|
||||
|
||||
double minEdgeLengthM = 50;
|
||||
string requestPath = request.Uri.substr(getUri().length());
|
||||
|
|
|
@ -347,7 +347,7 @@ public:
|
|||
if (NULL == osgDB::Registry::instance()->getReaderWriterForExtension(_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) {
|
||||
SG_LOG(SG_NETWORK, SG_WARN, "CanvasImage:CanvasMgr not found");
|
||||
} else {
|
||||
|
|
|
@ -63,7 +63,7 @@ bool FGNative::open() {
|
|||
// process work for this port
|
||||
bool FGNative::process()
|
||||
{
|
||||
FDMShell* fdm = static_cast<FDMShell*>(globals->get_subsystem("flight"));
|
||||
auto fdm = globals->get_subsystem<FDMShell>();
|
||||
FGInterface* fdmState = fdm->getInterface();
|
||||
if (!fdmState) {
|
||||
return false;
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
static naRef f_getHistory(const nasal::CallContext& ctx)
|
||||
{
|
||||
FGFlightHistory* history =
|
||||
static_cast<FGFlightHistory*>(globals->get_subsystem("history"));
|
||||
auto history = globals->get_subsystem<FGFlightHistory>();
|
||||
if( !history )
|
||||
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* canvas_mgr =
|
||||
static_cast<CanvasMgr*>(globals->get_subsystem("Canvas"));
|
||||
auto canvas_mgr = globals->get_subsystem<CanvasMgr>();
|
||||
if( !canvas_mgr )
|
||||
ctx.runtimeError("Failed to get Canvas subsystem");
|
||||
|
||||
|
@ -114,8 +113,7 @@ CanvasMgr& requireCanvasMgr(const nasal::ContextWrapper& ctx)
|
|||
|
||||
GUIMgr& requireGUIMgr(const nasal::ContextWrapper& ctx)
|
||||
{
|
||||
GUIMgr* mgr =
|
||||
static_cast<GUIMgr*>(globals->get_subsystem("CanvasGUI"));
|
||||
auto mgr = globals->get_subsystem<GUIMgr>();
|
||||
if( !mgr )
|
||||
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)
|
||||
{
|
||||
if (argc == 0) {
|
||||
FGRouteMgr* rm = static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"));
|
||||
auto rm = globals->get_subsystem<FGRouteMgr>();
|
||||
return ghostForFlightPlan(c, rm->flightPlan());
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef nasal::Ghost<simgear::HTTP::MemoryRequestRef> NasalMemoryRequest;
|
|||
|
||||
FGHTTPClient& requireHTTPClient(const nasal::ContextWrapper& ctx)
|
||||
{
|
||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
||||
auto http = globals->get_subsystem<FGHTTPClient>();
|
||||
if( !http )
|
||||
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());
|
||||
|
||||
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
|
||||
// inside the model.
|
||||
|
@ -138,7 +138,7 @@ void FGNasalModelData::unload()
|
|||
if (_module.empty())
|
||||
return;
|
||||
|
||||
FGNasalSys* nasalSys = (FGNasalSys*) globals->get_subsystem("nasal");
|
||||
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||
if(!nasalSys) {
|
||||
SG_LOG(SG_NASAL, SG_WARN, "Trying to run an <unload> script "
|
||||
"without Nasal subsystem present.");
|
||||
|
@ -204,7 +204,7 @@ void FGNasalModelDataProxy::modelLoaded( const std::string& path,
|
|||
if(!nasal)
|
||||
return;
|
||||
|
||||
FGNasalSys* nasalSys = (FGNasalSys*) globals->get_subsystem("nasal");
|
||||
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||
if(!nasalSys)
|
||||
{
|
||||
SG_LOG
|
||||
|
|
|
@ -44,7 +44,7 @@ void AudioIdent::init()
|
|||
_timer = 0.0;
|
||||
_ident = "";
|
||||
_running = false;
|
||||
_sgr = soundManager->find("avionics", true);
|
||||
_sgr = globals->get_subsystem<SGSoundMgr>()->find("avionics", true);
|
||||
_sgr->tie_to_listener();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ FGFLITEVoice::FGFLITEVoice(FGVoiceMgr * mgr, const SGPropertyNode_ptr node, cons
|
|||
|
||||
_synthesizer = new FLITEVoiceSynthesizer(voice.utf8Str());
|
||||
|
||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
_sgr = smgr->find(sampleGroupRefName, true);
|
||||
_sgr->tie_to_listener();
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ FGVoicePlayer::bind (SGPropertyNode *node, const char* default_dir_prefix)
|
|||
void
|
||||
FGVoicePlayer::init ()
|
||||
{
|
||||
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
auto smgr = globals->get_subsystem<SGSoundMgr>();
|
||||
_sgr = smgr->find("avionics", true);
|
||||
_sgr->tie_to_listener();
|
||||
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");
|
||||
int offset = arg->getIntValue("offset", 0);
|
||||
TimeManager* self = (TimeManager*) globals->get_subsystem("time");
|
||||
auto self = globals->get_subsystem<TimeManager>();
|
||||
if (offset_type == "real") {
|
||||
// without this, setting 'real' time is a no-op, since the current
|
||||
// wrap value (orig_warp) is retained in setTimeOffset. Ick.
|
||||
|
|
|
@ -57,7 +57,7 @@ void FGTide::unbind()
|
|||
#include <Main/fg_props.hxx>
|
||||
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
|
||||
// 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();
|
||||
|
||||
FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("traffic-manager");
|
||||
auto tmgr = globals->get_subsystem<FGTrafficManager>();
|
||||
FGScheduledFlightVecIterator fltBegin, fltEnd;
|
||||
fltBegin = tmgr->getFirstFlight(req);
|
||||
fltEnd = tmgr->getLastFlight(req);
|
||||
|
|
|
@ -613,7 +613,7 @@ void FGTrafficManager::finishInit()
|
|||
assert(doingInit);
|
||||
SG_LOG(SG_AI, SG_INFO, "finishing AI-Traffic init");
|
||||
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
|
||||
for (auto schedule : scheduledAircraft) {
|
||||
schedule->setScore();
|
||||
|
|
|
@ -178,8 +178,8 @@ public:
|
|||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glPushClientAttrib(~0u);
|
||||
|
||||
// HUD can be NULL
|
||||
HUD *hud = static_cast<HUD*>(globals->get_subsystem("hud"));
|
||||
// HUD can be NULL
|
||||
auto hud = globals->get_subsystem<HUD>();
|
||||
if (hud) {
|
||||
hud->draw(state);
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public:
|
|||
osg::LightSource* lightSource = static_cast<osg::LightSource*>(node);
|
||||
osg::Light* light = lightSource->getLight();
|
||||
|
||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
||||
auto l = globals->get_subsystem<FGLight>();
|
||||
if (!l) {
|
||||
// lighting is down during re-init
|
||||
return;
|
||||
|
@ -274,7 +274,7 @@ public:
|
|||
lightModel = static_cast<osg::LightModel*>(stateAttribute);
|
||||
|
||||
#if 0
|
||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
||||
auto l = globals->get_subsystem<FGLight>();
|
||||
lightModel->setAmbientIntensity(toOsg(l->scene_ambient());
|
||||
#else
|
||||
lightModel->setAmbientIntensity(osg::Vec4(0, 0, 0, 1));
|
||||
|
@ -626,7 +626,7 @@ FGRenderer::setupView( void )
|
|||
setupRoot();
|
||||
|
||||
// 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
|
||||
|
@ -817,7 +817,7 @@ FGRenderer::update( ) {
|
|||
fgSetBool("/sim/menubar/overlap-hide", false);
|
||||
}
|
||||
|
||||
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
|
||||
auto l = globals->get_subsystem<FGLight>();
|
||||
|
||||
// update fog params
|
||||
double actual_visibility;
|
||||
|
@ -895,7 +895,7 @@ FGRenderer::updateSky()
|
|||
double altitude_m = _altitude_ft->getDoubleValue() * SG_FEET_TO_METER;
|
||||
_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
|
||||
// actual distance. See FGRenderer::setupView() for more details.
|
||||
|
@ -920,7 +920,7 @@ FGRenderer::updateSky()
|
|||
scolor.moon_angle = l->get_moon_angle();
|
||||
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();
|
||||
_sky->reposition( sstate, *ephemerisSub->data(), delta_time_sec );
|
||||
_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()
|
||||
// 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;
|
||||
|
||||
for (Intersections::iterator hit = intersections.begin(),
|
||||
|
|
|
@ -61,7 +61,7 @@ void TrafficMgrTests::testParse() {
|
|||
globals->get_subsystem_mgr()->init();
|
||||
globals->get_subsystem_mgr()->postinit();
|
||||
|
||||
FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("traffic-manager");
|
||||
auto tmgr = globals->get_subsystem<FGTrafficManager>();
|
||||
FGScheduledFlightVecIterator fltBegin, fltEnd;
|
||||
|
||||
for (size_t i = 0; i < 1000000; i++)
|
||||
|
|
Loading…
Reference in a new issue