Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next
This commit is contained in:
commit
95a274c135
112 changed files with 1000 additions and 322 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 :(");
|
||||
|
||||
|
|
|
@ -91,7 +91,11 @@ The bind() and unbind() functions can be used to tie and untie properties.
|
|||
|
||||
Finally to create and have the subsystem managed:
|
||||
|
||||
globals->add_subsystem("example", new FGSubsystemExample);
|
||||
globals->get_subsystem_mgr()->add<FGSubsystemExample>();
|
||||
|
||||
or:
|
||||
|
||||
globals->get_subsystem_mgr()->add("example");
|
||||
|
||||
Now the subsystem manager calls the update() function of this class every
|
||||
frame. dt is the time (in seconds) elapsed since the last call.
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ void FGAirport::addLineFeature(FGPavementRef linefeature)
|
|||
FGRunwayRef FGAirport::getActiveRunwayForUsage() const
|
||||
{
|
||||
auto envMgr = globals->get_subsystem<FGEnvironmentMgr>();
|
||||
|
||||
|
||||
// This forces West-facing rwys to be used in no-wind situations
|
||||
// which is consistent with Flightgear's initial setup.
|
||||
double hdg = 270;
|
||||
|
|
|
@ -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,10 +779,10 @@ 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->add_subsystem("kln89", gps, SGSubsystemMgr::GENERAL);
|
||||
globals->get_subsystem_mgr()->add("kln89", gps);
|
||||
}
|
||||
//gps->init(); // init seems to get called automagically.
|
||||
FGSpecialInstrument* gpsinst = new FGSpecialInstrument(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,15 +92,15 @@ 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];
|
||||
args[0] = nasal::to_nasal(ctx, aPath);
|
||||
|
@ -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(
|
||||
|
@ -668,3 +668,7 @@ void Highlight::addPropertyProperty(const std::string& from0, const std::string&
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Register the subsystem.
|
||||
SGSubsystemMgr::Registrant<Highlight> registrantHighlight(
|
||||
SGSubsystemMgr::INIT);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -942,3 +942,7 @@ std::string ErrorReporter::threadSpecificContextValue(const std::string& key)
|
|||
|
||||
|
||||
} // namespace flightgear
|
||||
|
||||
// Register the subsystem.
|
||||
SGSubsystemMgr::Registrant<flightgear::ErrorReporter> registrantErrorReporter(
|
||||
SGSubsystemMgr::GENERAL);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -77,7 +77,6 @@
|
|||
#include <simgear/package/Catalog.hxx>
|
||||
|
||||
#include <Add-ons/AddonManager.hxx>
|
||||
|
||||
#include <Aircraft/controls.hxx>
|
||||
#include <Aircraft/replay.hxx>
|
||||
#include <Aircraft/FlightHistory.hxx>
|
||||
|
@ -95,7 +94,7 @@
|
|||
|
||||
#include <Cockpit/panel.hxx>
|
||||
#include <Cockpit/panel_io.hxx>
|
||||
|
||||
|
||||
#include <Canvas/canvas_mgr.hxx>
|
||||
#include <Canvas/gui_mgr.hxx>
|
||||
#include <Canvas/FGCanvasSystemAdapter.hxx>
|
||||
|
@ -981,6 +980,9 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "== Creating Subsystems");
|
||||
|
||||
// Fetch the subsystem manager.
|
||||
auto mgr = globals->get_subsystem_mgr();
|
||||
|
||||
globals->get_event_mgr()->init();
|
||||
globals->get_event_mgr()->setRealtimeProperty(fgGetNode("/sim/time/delta-realtime-sec", true));
|
||||
|
||||
|
@ -988,21 +990,20 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
{
|
||||
// Initialize the property interpolator subsystem. Put into the INIT
|
||||
// group because the "nasal" subsystem may need it at GENERAL take-down.
|
||||
globals->add_subsystem("prop-interpolator", new FGInterpolator, SGSubsystemMgr::INIT);
|
||||
globals->add_new_subsystem<Highlight>(SGSubsystemMgr::INIT);
|
||||
globals->add_subsystem("gui", new NewGUI, SGSubsystemMgr::INIT);
|
||||
mgr->add<FGInterpolator>();
|
||||
mgr->add<Highlight>();
|
||||
mgr->add<NewGUI>();
|
||||
}
|
||||
|
||||
// SGSubsystemMgr::GENERAL
|
||||
{
|
||||
globals->add_subsystem("properties", new FGProperties, SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_subsystem("performance-mon",
|
||||
mgr->add<FGProperties>();
|
||||
mgr->add<flightgear::AirportDynamicsManager>();
|
||||
mgr->add("performance-mon",
|
||||
new SGPerformanceMonitor(
|
||||
globals->get_subsystem_mgr(),
|
||||
mgr,
|
||||
fgGetNode("/sim/performance-monitor", true)
|
||||
),
|
||||
SGSubsystemMgr::GENERAL
|
||||
)
|
||||
);
|
||||
|
||||
// Initialize the material property subsystem.
|
||||
|
@ -1013,55 +1014,55 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
}
|
||||
|
||||
// may exist already due to GUI startup or --load-tape=http...
|
||||
if (!globals->get_subsystem<FGHTTPClient>()) {
|
||||
globals->add_new_subsystem<FGHTTPClient>(SGSubsystemMgr::GENERAL);
|
||||
if (!mgr->get_subsystem<FGHTTPClient>()) {
|
||||
mgr->add<FGHTTPClient>();
|
||||
}
|
||||
globals->add_new_subsystem<FGDNSClient>(SGSubsystemMgr::GENERAL);
|
||||
mgr->add<FGDNSClient>();
|
||||
|
||||
// Initialize the weather modeling subsystem
|
||||
globals->add_subsystem("environment", new FGEnvironmentMgr, SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<Ephemeris>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_subsystem( "xml-proprules", FGXMLAutopilotGroup::createInstance("property-rule"), SGSubsystemMgr::GENERAL );
|
||||
mgr->add<FGEnvironmentMgr>();
|
||||
mgr->add<Ephemeris>();
|
||||
mgr->add("xml-proprules", FGXMLAutopilotGroup::createInstance("property-rule"));
|
||||
|
||||
globals->add_new_subsystem<FGRouteMgr>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_subsystem( "io", new FGIO, SGSubsystemMgr::GENERAL );
|
||||
globals->add_subsystem("logger", new FGLogger, SGSubsystemMgr::GENERAL);
|
||||
mgr->add<FGRouteMgr>();
|
||||
mgr->add<FGIO>();
|
||||
mgr->add<FGLogger>();
|
||||
|
||||
globals->add_new_subsystem<FGControls>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<FGInput>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_subsystem("history", new FGFlightHistory, SGSubsystemMgr::GENERAL);
|
||||
mgr->add<FGControls>();
|
||||
mgr->add<FGInput>();
|
||||
mgr->add<FGFlightHistory>();
|
||||
|
||||
{
|
||||
SGSubsystem * httpd = flightgear::http::FGHttpd::createInstance( fgGetNode(flightgear::http::PROPERTY_ROOT) );
|
||||
if( NULL != httpd )
|
||||
globals->add_subsystem("httpd", httpd, SGSubsystemMgr::GENERAL );
|
||||
mgr->add("httpd", httpd);
|
||||
}
|
||||
|
||||
if (!duringReset) {
|
||||
globals->add_subsystem("tides", new FGTide, SGSubsystemMgr::GENERAL );
|
||||
mgr->add<FGTide>();
|
||||
}
|
||||
}
|
||||
|
||||
// SGSubsystemMgr::FDM
|
||||
{
|
||||
globals->add_subsystem("flight", new FDMShell, SGSubsystemMgr::FDM);
|
||||
mgr->add<FDMShell>();
|
||||
|
||||
// Initialize the aircraft systems and instrumentation (before the
|
||||
// autopilot.)
|
||||
globals->add_subsystem("systems", new FGSystemMgr, SGSubsystemMgr::FDM);
|
||||
globals->add_subsystem("instrumentation", new FGInstrumentMgr, SGSubsystemMgr::FDM);
|
||||
globals->add_subsystem( "xml-autopilot", FGXMLAutopilotGroup::createInstance("autopilot"), SGSubsystemMgr::FDM );
|
||||
mgr->add<FGSystemMgr>();
|
||||
mgr->add<FGInstrumentMgr>();
|
||||
mgr->add("xml-autopilot", FGXMLAutopilotGroup::createInstance("autopilot"));
|
||||
}
|
||||
|
||||
// SGSubsystemMgr::POST_FDM
|
||||
{
|
||||
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::POST_FDM);
|
||||
globals->add_subsystem("ATC", new FGATCManager, SGSubsystemMgr::POST_FDM);
|
||||
globals->add_subsystem("ai-model", new FGAIManager, SGSubsystemMgr::POST_FDM);
|
||||
globals->add_subsystem("mp", new FGMultiplayMgr, SGSubsystemMgr::POST_FDM);
|
||||
mgr->add<PerformanceDB>();
|
||||
mgr->add<FGATCManager>();
|
||||
mgr->add<FGAIManager>();
|
||||
mgr->add<FGMultiplayMgr>();
|
||||
|
||||
#ifdef ENABLE_SWIFT
|
||||
globals->add_subsystem("swift", new SwiftConnection, SGSubsystemMgr::POST_FDM);
|
||||
mgr->add<SwiftConnection>();
|
||||
#endif
|
||||
|
||||
// FGReplay.
|
||||
|
@ -1077,16 +1078,16 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
// problem where JSBSim appears to rely on FGReplay creating certain
|
||||
// properties before it is initialised. This caused problems when
|
||||
// FGReplay was changed to be POST_FDM.
|
||||
globals->add_new_subsystem<FGReplay>(SGSubsystemMgr::POST_FDM)
|
||||
->init(); // Special case.
|
||||
mgr->add<FGReplay>();
|
||||
mgr->get_subsystem<FGReplay>()->init(); // Special case.
|
||||
|
||||
//globals->add_subsystem("ai-model", new FGAIManager, SGSubsystemMgr::POST_FDM);
|
||||
globals->add_subsystem("submodel-mgr", new FGSubmodelMgr, SGSubsystemMgr::POST_FDM);
|
||||
//mgr->add<FGAIManager>();
|
||||
mgr->add<FGSubmodelMgr>();
|
||||
|
||||
// It's probably a good idea to initialize the top level traffic manager
|
||||
// After the AI and ATC systems have been initialized properly.
|
||||
// AI Traffic manager
|
||||
globals->add_subsystem("traffic-manager", new FGTrafficManager, SGSubsystemMgr::POST_FDM);
|
||||
mgr->add<FGTrafficManager>();
|
||||
|
||||
fgSetArchivable("/sim/panel/visibility");
|
||||
fgSetArchivable("/sim/panel/x-offset");
|
||||
|
@ -1096,32 +1097,32 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
|
||||
// SGSubsystemMgr::DISPLAY
|
||||
{
|
||||
globals->add_subsystem("hud", new HUD, SGSubsystemMgr::DISPLAY);
|
||||
globals->add_subsystem("cockpit-displays", new flightgear::CockpitDisplayManager, SGSubsystemMgr::DISPLAY);
|
||||
mgr->add<HUD>();
|
||||
mgr->add<flightgear::CockpitDisplayManager>();
|
||||
|
||||
simgear::canvas::Canvas::setSystemAdapter(
|
||||
simgear::canvas::SystemAdapterPtr(new canvas::FGCanvasSystemAdapter)
|
||||
);
|
||||
globals->add_subsystem("Canvas", new CanvasMgr, SGSubsystemMgr::DISPLAY);
|
||||
mgr->add<CanvasMgr>();
|
||||
|
||||
auto canvasGui = new GUIMgr;
|
||||
globals->add_subsystem("CanvasGUI", canvasGui, SGSubsystemMgr::DISPLAY);
|
||||
mgr->add("CanvasGUI", canvasGui);
|
||||
auto guiCamera = flightgear::getGUICamera(flightgear::CameraGroup::getDefault());
|
||||
canvasGui->setGUIViewAndCamera(globals->get_renderer()->getView(), guiCamera);
|
||||
|
||||
#ifdef ENABLE_AUDIO_SUPPORT
|
||||
globals->add_subsystem("voice", new FGVoiceMgr, SGSubsystemMgr::DISPLAY);
|
||||
mgr->add<FGVoiceMgr>();
|
||||
#endif
|
||||
|
||||
// ordering here is important : Nasal (via events), then models, then views
|
||||
if (!duringReset) {
|
||||
globals->add_subsystem("lighting", new FGLight, SGSubsystemMgr::DISPLAY);
|
||||
globals->add_subsystem("events", globals->get_event_mgr(), SGSubsystemMgr::DISPLAY);
|
||||
mgr->add<FGLight>();
|
||||
mgr->add("events", globals->get_event_mgr());
|
||||
}
|
||||
|
||||
globals->add_new_subsystem<FGAircraftModel>(SGSubsystemMgr::DISPLAY);
|
||||
globals->add_new_subsystem<FGModelMgr>(SGSubsystemMgr::DISPLAY);
|
||||
globals->add_new_subsystem<FGViewMgr>(SGSubsystemMgr::DISPLAY);
|
||||
mgr->add<FGAircraftModel>();
|
||||
mgr->add<FGModelMgr>();
|
||||
mgr->add<FGViewMgr>();
|
||||
}
|
||||
|
||||
// SGSubsystemMgr::SOUND
|
||||
|
@ -1130,7 +1131,7 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
// to be updated in every loop.
|
||||
// Sound manager is updated last so it can use the CPU while the GPU
|
||||
// is processing the scenery (doubled the frame-rate for me) -EMH-
|
||||
globals->add_new_subsystem<FGSoundManager>(SGSubsystemMgr::SOUND);
|
||||
mgr->add<FGSoundManager>();
|
||||
|
||||
#ifdef ENABLE_IAX
|
||||
// Initialize the FGCom subsystem.
|
||||
|
@ -1138,7 +1139,7 @@ void fgCreateSubsystems(bool duringReset) {
|
|||
// depends on OpenAL, which is shutdown when the SOUND group
|
||||
// shutdown.
|
||||
// Sentry: FLIGHTGEAR-66
|
||||
globals->add_new_subsystem<FGCom>(SGSubsystemMgr::SOUND);
|
||||
mgr->add<FGCom>();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1147,16 +1148,19 @@ void fgPostInitSubsystems()
|
|||
{
|
||||
SGTimeStamp st;
|
||||
st.stamp();
|
||||
|
||||
|
||||
// Fetch the subsystem manager.
|
||||
auto mgr = globals->get_subsystem_mgr();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Initialize the Nasal interpreter.
|
||||
// Do this last, so that the loaded scripts see initialized state
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
globals->add_new_subsystem<FGNasalSys>(SGSubsystemMgr::INIT);
|
||||
mgr->add<FGNasalSys>();
|
||||
|
||||
// initialize methods that depend on other subsystems.
|
||||
st.stamp();
|
||||
globals->get_subsystem_mgr()->postinit();
|
||||
mgr->postinit();
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Subsystems postinit took:" << st.elapsedMSec());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1189,54 +1193,56 @@ void fgStartReposition()
|
|||
// set this signal so Nasal scripts can take action.
|
||||
fgSetBool("/sim/signals/reinit", true);
|
||||
fgSetBool("/sim/crashed", false);
|
||||
|
||||
FDMShell* fdm = globals->get_subsystem<FDMShell>();
|
||||
fdm->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
|
||||
// not, and doing so seems to have other issues. All that's needed is to
|
||||
// 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
|
||||
fdm->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;
|
||||
}
|
||||
|
|
|
@ -402,7 +402,7 @@ void FGGlobals::append_fg_scenery (const SGPath &path)
|
|||
return;
|
||||
}
|
||||
|
||||
// tell the ResouceManager about the scenery path
|
||||
// tell the ResourceManager about the scenery path
|
||||
// needed to load Models from this scenery path
|
||||
simgear::ResourceManager::instance()->addBasePath(abspath, simgear::ResourceManager::PRIORITY_DEFAULT);
|
||||
|
||||
|
@ -416,6 +416,35 @@ void FGGlobals::append_fg_scenery (const SGPath &path)
|
|||
|
||||
// temporary fix so these values survive reset
|
||||
n->setAttribute(SGPropertyNode::PRESERVE, true);
|
||||
|
||||
// Add any sources.xml file to the property tree so we can provide attribution through the GUI
|
||||
SGPath sources = SGPath(abspath);
|
||||
sources.append("sources.xml");
|
||||
SG_LOG(SG_TERRAIN, SG_DEBUG, "Looking for source file " << sources << ". Exists ? " << sources.exists());
|
||||
if (sources.exists()) {
|
||||
// Determine the next free indice under /scenery/sources
|
||||
SGPropertyNode* sourcesProp = fgGetNode("/scenery/sources", true);
|
||||
int propIndex = 0;
|
||||
while (sourcesProp->getChild("directory", propIndex) != NULL) {
|
||||
++propIndex;
|
||||
}
|
||||
|
||||
sourcesProp = sourcesProp->getChild("directory", propIndex++, true);
|
||||
|
||||
// Add a reference to the path itself
|
||||
sourcesProp->setStringValue("path", abspath.utf8Str());
|
||||
|
||||
// Now load the sources file into /scenery/sources/source[n]
|
||||
if(!fgLoadProps(sources.utf8Str(), sourcesProp, false))
|
||||
{
|
||||
SG_LOG(SG_TERRAIN, SG_ALERT, "Unable to load sources file " << sources.utf8Str());
|
||||
}
|
||||
|
||||
// Ensure these properties cannot be over-ridden, and preserve them across a reset.
|
||||
sourcesProp->setAttribute(SGPropertyNode::WRITE, false);
|
||||
sourcesProp->setAttribute(SGPropertyNode::PRESERVE, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FGGlobals::append_read_allowed_paths(const SGPath &path)
|
||||
|
@ -573,15 +602,6 @@ FGGlobals::get_subsystem (const char * name) const
|
|||
return subsystem_mgr->get_subsystem(name);
|
||||
}
|
||||
|
||||
void
|
||||
FGGlobals::add_subsystem (const char * name,
|
||||
SGSubsystem * subsystem,
|
||||
SGSubsystemMgr::GroupType type,
|
||||
double min_time_sec)
|
||||
{
|
||||
subsystem_mgr->add(name, subsystem, type, min_time_sec);
|
||||
}
|
||||
|
||||
SGEventMgr *
|
||||
FGGlobals::get_event_mgr () const
|
||||
{
|
||||
|
@ -927,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
|
||||
|
@ -948,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
|
||||
{
|
||||
|
@ -180,19 +180,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
void add_subsystem (const char * name,
|
||||
SGSubsystem * subsystem,
|
||||
SGSubsystemMgr::GroupType type,
|
||||
double min_time_sec = 0);
|
||||
|
||||
template<class T>
|
||||
T* add_new_subsystem (SGSubsystemMgr::GroupType type, double min_time_sec = 0)
|
||||
{
|
||||
T* sub = new T;
|
||||
add_subsystem(T::staticSubsystemClassId(), sub, type, min_time_sec);
|
||||
return sub;
|
||||
}
|
||||
|
||||
SGEventMgr *get_event_mgr () const;
|
||||
|
||||
inline double get_sim_time_sec () const { return sim_time_sec; }
|
||||
|
|
|
@ -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();
|
||||
|
@ -186,9 +188,8 @@ static void initTerrasync()
|
|||
// hence not downloaded again.
|
||||
fgSetString("/sim/terrasync/installation-dir", (globals->get_fg_root() / "Scenery").utf8Str());
|
||||
|
||||
simgear::SGTerraSync* terra_sync = new simgear::SGTerraSync();
|
||||
auto terra_sync = globals->get_subsystem_mgr()->add<simgear::SGTerraSync>();
|
||||
terra_sync->setRoot(globals->get_props());
|
||||
globals->add_subsystem("terrasync", terra_sync, SGSubsystemMgr::GENERAL);
|
||||
|
||||
terra_sync->bind();
|
||||
terra_sync->init();
|
||||
|
@ -313,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())) {
|
||||
|
@ -338,7 +342,7 @@ static void fgIdleFunction ( void ) {
|
|||
} else if ( idle_state == 4 ) {
|
||||
idle_state++;
|
||||
|
||||
globals->add_new_subsystem<TimeManager>(SGSubsystemMgr::INIT);
|
||||
mgr->add<TimeManager>();
|
||||
|
||||
// Do some quick general initializations
|
||||
if( !fgInitGeneral()) {
|
||||
|
@ -368,16 +372,16 @@ 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.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
globals->add_new_subsystem<FGScenery>(SGSubsystemMgr::DISPLAY);
|
||||
globals->get_scenery()->init();
|
||||
globals->get_scenery()->bind();
|
||||
auto scenery = mgr->add<FGScenery>();
|
||||
scenery->init();
|
||||
scenery->bind();
|
||||
|
||||
fgSplashProgress("creating-subsystems");
|
||||
} else if (( idle_state == 7 ) || (idle_state == 2007)) {
|
||||
|
@ -402,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");
|
||||
|
@ -705,7 +709,7 @@ int fgMainInit( int argc, char **argv )
|
|||
fgInitSecureMode();
|
||||
fgInitAircraftPaths(false);
|
||||
|
||||
auto errorManager = globals->add_new_subsystem<flightgear::ErrorReporter>(SGSubsystemMgr::GENERAL);
|
||||
auto errorManager = globals->get_subsystem_mgr()->add<flightgear::ErrorReporter>();
|
||||
errorManager->preinit();
|
||||
|
||||
configResult = fgInitAircraft(false, didUseLauncher);
|
||||
|
@ -756,7 +760,7 @@ int fgMainInit( int argc, char **argv )
|
|||
// Copy the property nodes for the menus added by registered add-ons
|
||||
addons::AddonManager::instance()->addAddonMenusToFGMenubar();
|
||||
|
||||
auto presets = globals->add_new_subsystem<flightgear::GraphicsPresets>(SGSubsystemMgr::DISPLAY);
|
||||
auto presets = globals->get_subsystem_mgr()->add<flightgear::GraphicsPresets>();
|
||||
presets->applyInitialPreset();
|
||||
|
||||
// Initialize the Window/Graphics environment.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ FGHTTPClient* FGHTTPClient::getOrCreate()
|
|||
return ext;
|
||||
}
|
||||
|
||||
ext = globals->add_new_subsystem<FGHTTPClient>(SGSubsystemMgr::GENERAL);
|
||||
ext = globals->get_subsystem_mgr()->add<FGHTTPClient>();
|
||||
ext->init();
|
||||
return ext;
|
||||
}
|
||||
|
@ -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;
|
||||
|
|
|
@ -111,6 +111,8 @@ private:
|
|||
|
||||
typedef string_list ParameterList;
|
||||
|
||||
SGPropertyNode* getLsDir(SGPropertyNode* node, const ParameterList &tokens);
|
||||
|
||||
inline void node_not_found_error( const string& s ) const {
|
||||
throw "node '" + s + "' not found";
|
||||
}
|
||||
|
@ -330,21 +332,7 @@ FGProps::PropsChannel::foundTerminator()
|
|||
string command = tokens[0];
|
||||
|
||||
if (command == "ls") {
|
||||
SGPropertyNode* dir = node;
|
||||
if (tokens.size() == 2) {
|
||||
if (tokens[1][0] == '/') {
|
||||
dir = globals->get_props()->getNode( tokens[1].c_str() );
|
||||
} else {
|
||||
string s = path;
|
||||
s += "/";
|
||||
s += tokens[1];
|
||||
dir = globals->get_props()->getNode( s.c_str() );
|
||||
}
|
||||
|
||||
if (dir == 0) {
|
||||
node_not_found_error( tokens[1] );
|
||||
}
|
||||
}
|
||||
SGPropertyNode* dir = getLsDir(node, tokens);
|
||||
|
||||
for (int i = 0; i < dir->nChildren(); i++) {
|
||||
SGPropertyNode * child = dir->getChild(i);
|
||||
|
@ -367,7 +355,7 @@ FGProps::PropsChannel::foundTerminator()
|
|||
push( line.c_str() );
|
||||
}
|
||||
} else if (command == "ls2") {
|
||||
SGPropertyNode* dir = globals->get_props()->getNode(tokens[1]);
|
||||
SGPropertyNode* dir = getLsDir(node, tokens);
|
||||
if (dir) {
|
||||
int n = dir->nChildren();
|
||||
for (int i = 0; i < n; i++) {
|
||||
|
@ -721,6 +709,31 @@ nasal [EOF <marker>] execute arbitrary Nasal code (simulator must be running wi
|
|||
buffer.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return directory to use with ls or ls2 command.
|
||||
*/
|
||||
SGPropertyNode*
|
||||
FGProps::PropsChannel::getLsDir(SGPropertyNode* node, const ParameterList &tokens)
|
||||
{
|
||||
SGPropertyNode* dir = node;
|
||||
if (tokens.size() == 2) {
|
||||
if (tokens[1][0] == '/') {
|
||||
dir = globals->get_props()->getNode( tokens[1] );
|
||||
} else {
|
||||
string s = path;
|
||||
s += "/";
|
||||
s += tokens[1];
|
||||
dir = globals->get_props()->getNode( s );
|
||||
}
|
||||
|
||||
if (dir == nullptr) {
|
||||
node_not_found_error( tokens[1] );
|
||||
}
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -547,4 +547,9 @@ bool GraphicsPresets::saveToXML(const SGPath& path, const std::string& name, con
|
|||
return true;
|
||||
}
|
||||
|
||||
// Register the subsystem.
|
||||
SGSubsystemMgr::Registrant<GraphicsPresets> registrantGraphicsPresets(
|
||||
SGSubsystemMgr::DISPLAY);
|
||||
|
||||
|
||||
} // namespace flightgear
|
||||
|
|
|
@ -228,7 +228,7 @@ fgviewerMain(int argc, char** argv)
|
|||
// Now init the renderer, as we've got all the options, globals etc.
|
||||
fgrenderer->init();
|
||||
|
||||
FGScenery* scenery = globals->add_new_subsystem<FGScenery>(SGSubsystemMgr::DISPLAY);
|
||||
auto scenery = globals->get_subsystem_mgr()->add<FGScenery>();
|
||||
scenery->init();
|
||||
scenery->bind();
|
||||
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -69,7 +69,9 @@ include(Dart)
|
|||
# System test suites.
|
||||
add_test(AeroMeshSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s AeroMeshTests)
|
||||
#add_test(GPSSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s GPSTests)
|
||||
add_test(InstancedSubsystemSystemTests ${TESTSUITE_OUTPUT_DIR}/run_test_suite --ctest -s InstancedSubsystemTests)
|
||||
#add_test(NavaidsSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s NavaidsTests)
|
||||
add_test(NonInstancedSubsystemSystemTests ${TESTSUITE_OUTPUT_DIR}/run_test_suite --ctest -s NonInstancedSubsystemTests)
|
||||
|
||||
# Unit test suites.
|
||||
add_test(AddonManagementUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u AddonManagementTests)
|
||||
|
|
|
@ -49,7 +49,7 @@ TestPilot::TestPilot(SGPropertyNode_ptr props) :
|
|||
_groundspeedKnotsProp = _propRoot->getNode("velocities/groundspeed-kt", true);
|
||||
_verticalFPMProp = _propRoot->getNode("velocities/vertical-fpm", true);
|
||||
|
||||
globals->add_subsystem("flight", this, SGSubsystemMgr::FDM);
|
||||
globals->get_subsystem_mgr()->add("flight", this);
|
||||
}
|
||||
|
||||
TestPilot::~TestPilot()
|
||||
|
|
|
@ -48,7 +48,7 @@ void initScenery()
|
|||
render->setView(viewer.get());
|
||||
|
||||
// Start up the scenery subsystem.
|
||||
globals->add_new_subsystem<FGScenery>(SGSubsystemMgr::DISPLAY);
|
||||
globals->get_subsystem_mgr()->add<FGScenery>();
|
||||
globals->get_scenery()->init();
|
||||
globals->get_scenery()->bind();
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ void initTestGlobals(const std::string& testName)
|
|||
|
||||
fgSetDefaults();
|
||||
|
||||
auto t = globals->add_new_subsystem<TimeManager>(SGSubsystemMgr::INIT);
|
||||
auto t = globals->get_subsystem_mgr()->add<TimeManager>();
|
||||
t->bind();
|
||||
t->init(); // establish mag-var data
|
||||
|
||||
|
@ -79,7 +79,7 @@ void initTestGlobals(const std::string& testName)
|
|||
* Here the event manager is added to the subsystem manager so it can be
|
||||
* destroyed via the subsystem manager.
|
||||
*/
|
||||
globals->add_subsystem("events", globals->get_event_mgr(), SGSubsystemMgr::DISPLAY);
|
||||
globals->get_subsystem_mgr()->add("events", globals->get_event_mgr());
|
||||
|
||||
// necessary to avoid asserts: mark FGLocale as initialized
|
||||
globals->get_locale()->selectLanguage({});
|
||||
|
@ -169,10 +169,10 @@ void initStandardNasal(bool withCanvas)
|
|||
nasalNode->setBoolValue("local_weather/enabled", false);
|
||||
|
||||
// Nasal needs the interpolator running
|
||||
globals->add_subsystem("prop-interpolator", new FGInterpolator, SGSubsystemMgr::INIT);
|
||||
globals->get_subsystem_mgr()->add<FGInterpolator>();
|
||||
|
||||
// will be inited, since we already did that
|
||||
globals->add_new_subsystem<FGNasalSys>(SGSubsystemMgr::INIT);
|
||||
globals->get_subsystem_mgr()->add<FGNasalSys>();
|
||||
}
|
||||
|
||||
void populateFPWithoutNasal(flightgear::FlightPlanRef f,
|
||||
|
|
|
@ -31,7 +31,7 @@ void CanvasTests::setUp()
|
|||
simgear::canvas::SystemAdapterPtr(new canvas::FGCanvasSystemAdapter)
|
||||
);
|
||||
|
||||
globals->add_subsystem("Canvas", new CanvasMgr, SGSubsystemMgr::DISPLAY);
|
||||
globals->get_subsystem_mgr()->add<CanvasMgr>();
|
||||
|
||||
globals->get_subsystem_mgr()->bind();
|
||||
globals->get_subsystem_mgr()->init();
|
||||
|
|
|
@ -4,6 +4,7 @@ foreach( system_test_category
|
|||
Instrumentation
|
||||
Navaids
|
||||
Main
|
||||
subsystems
|
||||
)
|
||||
|
||||
add_subdirectory(${system_test_category})
|
||||
|
|
|
@ -85,9 +85,10 @@ void AeroMeshTests::testLiftComputation()
|
|||
props->setDoubleValue("geometry/wing/chord-ft", c);
|
||||
props->setDoubleValue("geometry/weight-lbs", weight);
|
||||
|
||||
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::POST_FDM);
|
||||
globals->get_subsystem<PerformanceDB>()->bind();
|
||||
globals->get_subsystem<PerformanceDB>()->init();
|
||||
auto subsystem_mgr = globals->get_subsystem_mgr();
|
||||
subsystem_mgr->add<PerformanceDB>();
|
||||
subsystem_mgr->get_subsystem<PerformanceDB>()->bind();
|
||||
subsystem_mgr->get_subsystem<PerformanceDB>()->init();
|
||||
|
||||
FGAIManager *aiManager = new FGAIManager;
|
||||
FGAIAircraft *ai = new FGAIAircraft;
|
||||
|
|
|
@ -120,10 +120,10 @@ void GPSTests::testGPS()
|
|||
|
||||
|
||||
FGRouteMgr* rm = new FGRouteMgr;
|
||||
globals->add_subsystem( "route-manager", rm );
|
||||
globals->get_subsystem_mgr()->add( "route-manager", rm );
|
||||
|
||||
// FGEnvironmentMgr* envMgr = new FGEnvironmentMgr;
|
||||
// globals->add_subsystem("environment", envMgr);
|
||||
// globals->get_subsystem_mgr()->add("environment", envMgr);
|
||||
// envMgr->init();
|
||||
|
||||
fgSetBool("/sim/realism/simple-gps", true);
|
||||
|
@ -132,7 +132,7 @@ void GPSTests::testGPS()
|
|||
|
||||
SGPropertyNode* nd = fgGetNode("/instrumentation/gps", true);
|
||||
GPS* gps = new GPS(nd);
|
||||
globals->add_subsystem("gps", gps);
|
||||
globals->get_subsystem_mgr()->add("gps", gps);
|
||||
|
||||
const FGAirport* egph = fgFindAirportID("EGPH");
|
||||
testSetPosition(egph->geod());
|
||||
|
|
14
test_suite/system_tests/subsystems/CMakeLists.txt
Normal file
14
test_suite/system_tests/subsystems/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
set(TESTSUITE_SOURCES
|
||||
${TESTSUITE_SOURCES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TestSuite.cxx
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_instanced_creation.cxx
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_noninstanced_creation.cxx
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
set(TESTSUITE_HEADERS
|
||||
${TESTSUITE_HEADERS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_instanced_creation.hxx
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_noninstanced_creation.hxx
|
||||
PARENT_SCOPE
|
||||
)
|
26
test_suite/system_tests/subsystems/TestSuite.cxx
Normal file
26
test_suite/system_tests/subsystems/TestSuite.cxx
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Edward d'Auvergne
|
||||
*
|
||||
* This file is part of the program FlightGear.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "test_instanced_creation.hxx"
|
||||
#include "test_noninstanced_creation.hxx"
|
||||
|
||||
|
||||
// Set up the unit tests.
|
||||
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(InstancedSubsystemTests, "System tests");
|
||||
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(NonInstancedSubsystemTests, "System tests");
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Edward d'Auvergne
|
||||
*
|
||||
* This file is part of the program FlightGear.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "test_suite/FGTestApi/testGlobals.hxx"
|
||||
|
||||
#include "test_instanced_creation.hxx"
|
||||
|
||||
|
||||
// Set up function for each test.
|
||||
void InstancedSubsystemTests::setUp()
|
||||
{
|
||||
// First set up the globals object.
|
||||
FGTestApi::setUp::initTestGlobals("InstancedSubsystemCreationTests");
|
||||
|
||||
// The subsystem manager.
|
||||
_mgr.reset(new SGSubsystemMgr());
|
||||
}
|
||||
|
||||
|
||||
// Clean up after each test.
|
||||
void InstancedSubsystemTests::tearDown()
|
||||
{
|
||||
// Remove the manager.
|
||||
_mgr.reset();
|
||||
|
||||
// Clean up globals.
|
||||
FGTestApi::tearDown::shutdownTestGlobals();
|
||||
}
|
||||
|
||||
|
||||
// Helper functions.
|
||||
void InstancedSubsystemTests::create(const char* name)
|
||||
{
|
||||
// Create two subsystem instances and add them to the manager.
|
||||
_mgr->addInstance(name, "inst1");
|
||||
_mgr->addInstance(name, "inst2");
|
||||
auto sub1 = _mgr->get_subsystem(name, "inst1");
|
||||
auto sub2 = _mgr->get_subsystem(name, "inst2");
|
||||
|
||||
// Check the first subsystem.
|
||||
CPPUNIT_ASSERT(sub1);
|
||||
CPPUNIT_ASSERT_EQUAL(sub1->subsystemId(), std::string(name) + ".inst1");
|
||||
CPPUNIT_ASSERT_EQUAL(sub1->subsystemClassId(), std::string(name));
|
||||
CPPUNIT_ASSERT_EQUAL(sub1->subsystemInstanceId(), std::string("inst1"));
|
||||
|
||||
// Check the second subsystem.
|
||||
CPPUNIT_ASSERT(sub2);
|
||||
CPPUNIT_ASSERT_EQUAL(sub2->subsystemId(), std::string(name) + ".inst2");
|
||||
CPPUNIT_ASSERT_EQUAL(sub2->subsystemClassId(), std::string(name));
|
||||
CPPUNIT_ASSERT_EQUAL(sub2->subsystemInstanceId(), std::string("inst2"));
|
||||
}
|
||||
|
||||
|
||||
// The instanced subsystems.
|
||||
void InstancedSubsystemTests::testADF() { create("adf"); }
|
||||
void InstancedSubsystemTests::testAirspeedIndicator() { create("airspeed-indicator"); }
|
||||
void InstancedSubsystemTests::testAltimeter() { create("altimeter"); }
|
||||
void InstancedSubsystemTests::testAttitudeIndicator() { create("attitude-indicator"); }
|
||||
void InstancedSubsystemTests::testClock() { create("clock"); }
|
||||
void InstancedSubsystemTests::testCommRadio() { create("comm-radio"); }
|
||||
void InstancedSubsystemTests::testDME() { create("dme"); }
|
||||
void InstancedSubsystemTests::testFGKR_87() { create("KR-87"); }
|
||||
void InstancedSubsystemTests::testFGMarkerBeacon() { create("marker-beacon"); }
|
||||
void InstancedSubsystemTests::testFGNavRadio() { create("old-navradio"); }
|
||||
void InstancedSubsystemTests::testGPS() { create("gps"); }
|
||||
void InstancedSubsystemTests::testGSDI() { create("gsdi"); }
|
||||
void InstancedSubsystemTests::testHeadingIndicator() { create("heading-indicator"); }
|
||||
void InstancedSubsystemTests::testHeadingIndicatorDG() { create("heading-indicator-dg"); }
|
||||
void InstancedSubsystemTests::testHeadingIndicatorFG() { create("heading-indicator-fg"); }
|
||||
void InstancedSubsystemTests::testHUD() { create("hud"); }
|
||||
void InstancedSubsystemTests::testInstVerticalSpeedIndicator() { create("inst-vertical-speed-indicator"); }
|
||||
void InstancedSubsystemTests::testKLN89() { create("kln89"); }
|
||||
void InstancedSubsystemTests::testMagCompass() { create("magnetic-compass"); }
|
||||
void InstancedSubsystemTests::testMasterReferenceGyro() { create("master-reference-gyro"); }
|
||||
void InstancedSubsystemTests::testMK_VIII() { create("mk-viii"); }
|
||||
void InstancedSubsystemTests::testNavRadio() { create("nav-radio"); }
|
||||
void InstancedSubsystemTests::testRadarAltimeter() { create("radar-altimeter"); }
|
||||
void InstancedSubsystemTests::testSlipSkidBall() { create("slip-skid-ball"); }
|
||||
void InstancedSubsystemTests::testTACAN() { create("tacan"); }
|
||||
void InstancedSubsystemTests::testTCAS() { create("tcas"); }
|
||||
void InstancedSubsystemTests::testTransponder() { create("transponder"); }
|
||||
void InstancedSubsystemTests::testTurnIndicator() { create("turn-indicator"); }
|
||||
void InstancedSubsystemTests::testVerticalSpeedIndicator() { create("vertical-speed-indicator"); }
|
113
test_suite/system_tests/subsystems/test_instanced_creation.hxx
Normal file
113
test_suite/system_tests/subsystems/test_instanced_creation.hxx
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Edward d'Auvergne
|
||||
*
|
||||
* This file is part of the program FlightGear.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FG_INSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX
|
||||
#define _FG_INSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX
|
||||
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <cppunit/TestFixture.h>
|
||||
|
||||
#include <simgear/structure/subsystem_mgr.hxx>
|
||||
|
||||
|
||||
// The system tests.
|
||||
class InstancedSubsystemTests : public CppUnit::TestFixture
|
||||
{
|
||||
// Set up the test suite.
|
||||
CPPUNIT_TEST_SUITE(InstancedSubsystemTests);
|
||||
//CPPUNIT_TEST(testADF); // Not registered yet.
|
||||
//CPPUNIT_TEST(testAirspeedIndicator); // Not registered yet.
|
||||
//CPPUNIT_TEST(testAltimeter); // Not registered yet.
|
||||
//CPPUNIT_TEST(testAttitudeIndicator); // Not registered yet.
|
||||
//CPPUNIT_TEST(testCommRadio); // Not registered yet.
|
||||
//CPPUNIT_TEST(testClock); // Not registered yet.
|
||||
//CPPUNIT_TEST(testDME); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGKR_87); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGMarkerBeacon); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGNavRadio); // Not registered yet.
|
||||
//CPPUNIT_TEST(testGPS); // Not registered yet.
|
||||
//CPPUNIT_TEST(testGSDI); // Not registered yet.
|
||||
//CPPUNIT_TEST(testHeadingIndicator); // Not registered yet.
|
||||
//CPPUNIT_TEST(testHeadingIndicatorDG); // Not registered yet.
|
||||
//CPPUNIT_TEST(testHeadingIndicatorFG); // Not registered yet.
|
||||
//CPPUNIT_TEST(testHUD); // Segfault.
|
||||
//CPPUNIT_TEST(testInstVerticalSpeedIndicator); // Not registered yet.
|
||||
//CPPUNIT_TEST(testKLN89); // Not registered yet.
|
||||
//CPPUNIT_TEST(testMagCompass); // Not registered yet.
|
||||
//CPPUNIT_TEST(testMasterReferenceGyro); // Not registered yet.
|
||||
//CPPUNIT_TEST(testMK_VIII); // Not registered yet.
|
||||
//CPPUNIT_TEST(testNavRadio); // Segfault.
|
||||
//CPPUNIT_TEST(testRadarAltimeter); // Not registered yet.
|
||||
//CPPUNIT_TEST(testSlipSkidBall); // Not registered yet.
|
||||
//CPPUNIT_TEST(testTACAN); // Not registered yet.
|
||||
//CPPUNIT_TEST(testTCAS); // Not registered yet.
|
||||
//CPPUNIT_TEST(testTransponder); // Not registered yet.
|
||||
//CPPUNIT_TEST(testTurnIndicator); // Not registered yet.
|
||||
//CPPUNIT_TEST(testVerticalSpeedIndicator); // Not registered yet.
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
// Set up function for each test.
|
||||
void setUp();
|
||||
|
||||
// Clean up after each test.
|
||||
void tearDown();
|
||||
|
||||
// The subsystem tests.
|
||||
void testADF();
|
||||
void testAirspeedIndicator();
|
||||
void testAltimeter();
|
||||
void testAttitudeIndicator();
|
||||
void testClock();
|
||||
void testCommRadio();
|
||||
void testDME();
|
||||
void testFGKR_87();
|
||||
void testFGMarkerBeacon();
|
||||
void testFGNavRadio();
|
||||
void testGPS();
|
||||
void testGSDI();
|
||||
void testHeadingIndicator();
|
||||
void testHeadingIndicatorDG();
|
||||
void testHeadingIndicatorFG();
|
||||
void testHUD();
|
||||
void testInstVerticalSpeedIndicator();
|
||||
void testKLN89();
|
||||
void testMagCompass();
|
||||
void testMasterReferenceGyro();
|
||||
void testMK_VIII();
|
||||
void testNavRadio();
|
||||
void testRadarAltimeter();
|
||||
void testSlipSkidBall();
|
||||
void testTACAN();
|
||||
void testTCAS();
|
||||
void testTransponder();
|
||||
void testTurnIndicator();
|
||||
void testVerticalSpeedIndicator();
|
||||
|
||||
private:
|
||||
// The subsystem manager.
|
||||
std::unique_ptr<SGSubsystemMgr> _mgr;
|
||||
|
||||
// Helper functions.
|
||||
void create(const char* name);
|
||||
};
|
||||
|
||||
#endif // _FG_INSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX
|
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Edward d'Auvergne
|
||||
*
|
||||
* This file is part of the program FlightGear.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "test_suite/FGTestApi/testGlobals.hxx"
|
||||
|
||||
#include "test_noninstanced_creation.hxx"
|
||||
|
||||
|
||||
// Set up function for each test.
|
||||
void NonInstancedSubsystemTests::setUp()
|
||||
{
|
||||
// First set up the globals object.
|
||||
FGTestApi::setUp::initTestGlobals("NonInstancedSubsystemCreationTests");
|
||||
|
||||
// The subsystem manager.
|
||||
_mgr.reset(new SGSubsystemMgr());
|
||||
}
|
||||
|
||||
|
||||
// Clean up after each test.
|
||||
void NonInstancedSubsystemTests::tearDown()
|
||||
{
|
||||
// Remove the manager.
|
||||
_mgr.reset();
|
||||
|
||||
// Clean up globals.
|
||||
FGTestApi::tearDown::shutdownTestGlobals();
|
||||
}
|
||||
|
||||
|
||||
// Helper functions.
|
||||
void NonInstancedSubsystemTests::create(const char* name)
|
||||
{
|
||||
// Create the subsystem.
|
||||
_mgr->add(name);
|
||||
auto sub = _mgr->get_subsystem(name);
|
||||
|
||||
// Check the subsystem.
|
||||
CPPUNIT_ASSERT(sub);
|
||||
CPPUNIT_ASSERT_EQUAL(sub->subsystemId(), std::string(name));
|
||||
CPPUNIT_ASSERT_EQUAL(sub->subsystemClassId(), std::string(name));
|
||||
CPPUNIT_ASSERT_EQUAL(sub->subsystemInstanceId(), std::string());
|
||||
}
|
||||
|
||||
|
||||
// The non-instanced subsystems.
|
||||
void NonInstancedSubsystemTests::testagRadar() { create("air-ground-radar"); }
|
||||
void NonInstancedSubsystemTests::testAirportDynamicsManager() { create("airport-dynamics"); }
|
||||
void NonInstancedSubsystemTests::testAreaSampler() { create("area"); }
|
||||
void NonInstancedSubsystemTests::testAutopilot() { create("autopilot"); }
|
||||
void NonInstancedSubsystemTests::testCanvasMgr() { create("Canvas"); }
|
||||
void NonInstancedSubsystemTests::testCockpitDisplayManager() { create("cockpit-displays"); }
|
||||
void NonInstancedSubsystemTests::testDigitalFilter() { create("filter"); }
|
||||
void NonInstancedSubsystemTests::testEphemeris() { create("ephemeris"); }
|
||||
void NonInstancedSubsystemTests::testErrorReporter() { create("error-reporting"); }
|
||||
void NonInstancedSubsystemTests::testFDMShell() { create("flight"); }
|
||||
void NonInstancedSubsystemTests::testFGACMS() { create("acms"); }
|
||||
void NonInstancedSubsystemTests::testFGADA() { create("ada"); }
|
||||
void NonInstancedSubsystemTests::testFGAIManager() { create("ai-model"); }
|
||||
void NonInstancedSubsystemTests::testFGAircraftModel() { create("aircraft-model"); }
|
||||
void NonInstancedSubsystemTests::testFGATCManager() { create("ATC"); }
|
||||
void NonInstancedSubsystemTests::testFGBalloonSim() { create("balloon"); }
|
||||
void NonInstancedSubsystemTests::testFGCom() { create("fgcom"); }
|
||||
void NonInstancedSubsystemTests::testFGControls() { create("controls"); }
|
||||
void NonInstancedSubsystemTests::testFGDNSClient() { create("dns"); }
|
||||
void NonInstancedSubsystemTests::testFGElectricalSystem() { create("electrical"); }
|
||||
void NonInstancedSubsystemTests::testFGEnvironmentMgr() { create("environment"); }
|
||||
void NonInstancedSubsystemTests::testFGExternalNet() { create("network"); }
|
||||
void NonInstancedSubsystemTests::testFGExternalPipe() { create("pipe"); }
|
||||
void NonInstancedSubsystemTests::testFGFlightHistory() { create("history"); }
|
||||
void NonInstancedSubsystemTests::testFGHIDEventInput() { create("input-event-hid"); }
|
||||
void NonInstancedSubsystemTests::testFGHTTPClient() { create("http"); }
|
||||
void NonInstancedSubsystemTests::testFGHttpd() { create("httpd"); }
|
||||
void NonInstancedSubsystemTests::testFGInput() { create("input"); }
|
||||
void NonInstancedSubsystemTests::testFGInstrumentMgr() { create("instrumentation"); }
|
||||
void NonInstancedSubsystemTests::testFGInterpolator() { create("prop-interpolator"); }
|
||||
void NonInstancedSubsystemTests::testFGIO() { create("io"); }
|
||||
void NonInstancedSubsystemTests::testFGJoystickInput() { create("input-joystick"); }
|
||||
void NonInstancedSubsystemTests::testFGJSBsim() { create("jsb"); }
|
||||
void NonInstancedSubsystemTests::testFGKeyboardInput() { create("input-keyboard"); }
|
||||
void NonInstancedSubsystemTests::testFGLaRCsim() { create("larcsim"); }
|
||||
void NonInstancedSubsystemTests::testFGLight() { create("lighting"); }
|
||||
void NonInstancedSubsystemTests::testFGLinuxEventInput() { create("input-event"); }
|
||||
void NonInstancedSubsystemTests::testFGLogger() { create("logger"); }
|
||||
void NonInstancedSubsystemTests::testFGMacOSXEventInput() { create("input-event"); }
|
||||
void NonInstancedSubsystemTests::testFGMagicCarpet() { create("magic"); }
|
||||
void NonInstancedSubsystemTests::testFGMagVarManager() { create("magvar"); }
|
||||
void NonInstancedSubsystemTests::testFGModelMgr() { create("model-manager"); }
|
||||
void NonInstancedSubsystemTests::testFGMouseInput() { create("input-mouse"); }
|
||||
void NonInstancedSubsystemTests::testFGMultiplayMgr() { create("mp"); }
|
||||
void NonInstancedSubsystemTests::testFGNasalSys() { create("nasal"); }
|
||||
void NonInstancedSubsystemTests::testFGNullFDM() { create("null"); }
|
||||
void NonInstancedSubsystemTests::testFGPanel() { create("panel"); }
|
||||
void NonInstancedSubsystemTests::testFGPrecipitationMgr() { create("precipitation"); }
|
||||
void NonInstancedSubsystemTests::testFGProperties() { create("properties"); }
|
||||
void NonInstancedSubsystemTests::testFGReplay() { create("replay"); }
|
||||
void NonInstancedSubsystemTests::testFGRidgeLift() { create("ridgelift"); }
|
||||
void NonInstancedSubsystemTests::testFGRouteMgr() { create("route-manager"); }
|
||||
void NonInstancedSubsystemTests::testFGScenery() { create("scenery"); }
|
||||
void NonInstancedSubsystemTests::testFGSoundManager() { create("sound"); }
|
||||
void NonInstancedSubsystemTests::testFGSubmodelMgr() { create("submodel-mgr"); }
|
||||
void NonInstancedSubsystemTests::testFGSystemMgr() { create("systems"); }
|
||||
void NonInstancedSubsystemTests::testFGTrafficManager() { create("traffic-manager"); }
|
||||
void NonInstancedSubsystemTests::testFGUFO() { create("ufo"); }
|
||||
void NonInstancedSubsystemTests::testFGViewMgr() { create("view-manager"); }
|
||||
void NonInstancedSubsystemTests::testFGVoiceMgr() { create("voice"); }
|
||||
void NonInstancedSubsystemTests::testFGXMLAutopilotGroup() { create("xml-rules"); }
|
||||
void NonInstancedSubsystemTests::testFlipFlop() { create("flipflop"); }
|
||||
void NonInstancedSubsystemTests::testGraphicsPresets() { create("graphics-presets"); }
|
||||
void NonInstancedSubsystemTests::testGroundRadar() { create("groundradar"); }
|
||||
void NonInstancedSubsystemTests::testGUIMgr() { create("CanvasGUI"); }
|
||||
void NonInstancedSubsystemTests::testHighlight() { create("reflect"); }
|
||||
void NonInstancedSubsystemTests::testInstrumentGroup() { create("instruments"); }
|
||||
void NonInstancedSubsystemTests::testLogic() { create("logic"); }
|
||||
void NonInstancedSubsystemTests::testNavDisplay() { create("navigation-display"); }
|
||||
void NonInstancedSubsystemTests::testNewGUI() { create("gui"); }
|
||||
void NonInstancedSubsystemTests::testNoaaMetarRealWxController() { create("noaa-metar"); }
|
||||
void NonInstancedSubsystemTests::testPerformanceDB() { create("aircraft-performance-db"); }
|
||||
void NonInstancedSubsystemTests::testPIDController() { create("pid-controller"); }
|
||||
void NonInstancedSubsystemTests::testPISimpleController() { create("pi-simple-controller"); }
|
||||
void NonInstancedSubsystemTests::testPitotSystem() { create("pitot"); }
|
||||
void NonInstancedSubsystemTests::testPredictor() { create("predict-simple"); }
|
||||
void NonInstancedSubsystemTests::testSGEventMgr() { create("events"); }
|
||||
void NonInstancedSubsystemTests::testSGPerformanceMonitor() { create("performance-mon"); }
|
||||
void NonInstancedSubsystemTests::testSGSoundMgr() { create("sound"); }
|
||||
void NonInstancedSubsystemTests::testSGTerraSync() { create("terrasync"); }
|
||||
void NonInstancedSubsystemTests::testStateMachineComponent() { create("state-machine"); }
|
||||
void NonInstancedSubsystemTests::testStaticSystem() { create("static"); }
|
||||
void NonInstancedSubsystemTests::testTimeManager() { create("time"); }
|
||||
void NonInstancedSubsystemTests::testVacuumSystem() { create("vacuum"); }
|
||||
void NonInstancedSubsystemTests::testView() { create("view"); }
|
||||
void NonInstancedSubsystemTests::testwxRadarBg() { create("radar"); }
|
||||
void NonInstancedSubsystemTests::testYASim() { create("yasim"); }
|
|
@ -0,0 +1,229 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Edward d'Auvergne
|
||||
*
|
||||
* This file is part of the program FlightGear.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FG_NONINSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX
|
||||
#define _FG_NONINSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX
|
||||
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <cppunit/TestFixture.h>
|
||||
|
||||
#include <simgear/structure/subsystem_mgr.hxx>
|
||||
|
||||
|
||||
// The system tests.
|
||||
class NonInstancedSubsystemTests : public CppUnit::TestFixture
|
||||
{
|
||||
// Set up the test suite.
|
||||
CPPUNIT_TEST_SUITE(NonInstancedSubsystemTests);
|
||||
//CPPUNIT_TEST(testagRadar); // Not registered yet.
|
||||
CPPUNIT_TEST(testAirportDynamicsManager);
|
||||
//CPPUNIT_TEST(testAreaSampler); // Not registered yet.
|
||||
//CPPUNIT_TEST(testAutopilot); // Not registered yet.
|
||||
CPPUNIT_TEST(testCanvasMgr);
|
||||
CPPUNIT_TEST(testCockpitDisplayManager);
|
||||
CPPUNIT_TEST(testDigitalFilter);
|
||||
CPPUNIT_TEST(testEphemeris);
|
||||
CPPUNIT_TEST(testErrorReporter);
|
||||
CPPUNIT_TEST(testFDMShell);
|
||||
//CPPUNIT_TEST(testFGACMS); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGADA); // Not registered yet.
|
||||
CPPUNIT_TEST(testFGAIManager);
|
||||
CPPUNIT_TEST(testFGAircraftModel);
|
||||
CPPUNIT_TEST(testFGATCManager);
|
||||
//CPPUNIT_TEST(testFGBalloonSim); // Not registered yet.
|
||||
CPPUNIT_TEST(testFGCom);
|
||||
CPPUNIT_TEST(testFGControls);
|
||||
CPPUNIT_TEST(testFGDNSClient);
|
||||
//CPPUNIT_TEST(testFGElectricalSystem); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGEnvironmentMgr); // Segfault.
|
||||
//CPPUNIT_TEST(testFGExternalNet); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGExternalPipe); // Not registered yet.
|
||||
CPPUNIT_TEST(testFGFlightHistory);
|
||||
CPPUNIT_TEST(testFGHIDEventInput);
|
||||
CPPUNIT_TEST(testFGHTTPClient);
|
||||
//CPPUNIT_TEST(testFGHttpd); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGInput); // Segfault.
|
||||
CPPUNIT_TEST(testFGInstrumentMgr);
|
||||
CPPUNIT_TEST(testFGInterpolator);
|
||||
CPPUNIT_TEST(testFGIO);
|
||||
//CPPUNIT_TEST(testFGJoystickInput); // Segfault.
|
||||
//CPPUNIT_TEST(testFGJSBsim); // Not registered yet.
|
||||
CPPUNIT_TEST(testFGKeyboardInput);
|
||||
//CPPUNIT_TEST(testFGLaRCsim); // Not registered yet.
|
||||
CPPUNIT_TEST(testFGLight);
|
||||
//CPPUNIT_TEST(testFGLinuxEventInput); // Need to handle #define INPUTEVENT_CLASS FGLinuxEventInput.
|
||||
CPPUNIT_TEST(testFGLogger);
|
||||
//CPPUNIT_TEST(testFGMacOSXEventInput); // Need to handle #define INPUTEVENT_CLASS FGMacOSXEventInput.
|
||||
//CPPUNIT_TEST(testFGMagicCarpet); // Not registered yet.
|
||||
CPPUNIT_TEST(testFGMagVarManager);
|
||||
CPPUNIT_TEST(testFGModelMgr);
|
||||
CPPUNIT_TEST(testFGMouseInput);
|
||||
//CPPUNIT_TEST(testFGMultiplayMgr); // double free or corruption (fasttop): 0x0000000006423860
|
||||
CPPUNIT_TEST(testFGNasalSys);
|
||||
//CPPUNIT_TEST(testFGNullFDM); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGPanel); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGPrecipitationMgr); // Segfault.
|
||||
CPPUNIT_TEST(testFGProperties);
|
||||
//CPPUNIT_TEST(testFGReplay); // Segfault.
|
||||
CPPUNIT_TEST(testFGRidgeLift);
|
||||
//CPPUNIT_TEST(testFGRouteMgr); // Partially unstable (sometimes segfault or sometimes double free or corruption).
|
||||
//CPPUNIT_TEST(testFGScenery); // Segfault.
|
||||
CPPUNIT_TEST(testFGSoundManager);
|
||||
CPPUNIT_TEST(testFGSubmodelMgr);
|
||||
CPPUNIT_TEST(testFGSystemMgr);
|
||||
CPPUNIT_TEST(testFGTrafficManager);
|
||||
//CPPUNIT_TEST(testFGUFO); // Not registered yet.
|
||||
//CPPUNIT_TEST(testFGViewMgr); // Not registered yet.
|
||||
CPPUNIT_TEST(testFGVoiceMgr);
|
||||
//CPPUNIT_TEST(testFGXMLAutopilotGroup); // Not registered yet.
|
||||
CPPUNIT_TEST(testFlipFlop);
|
||||
CPPUNIT_TEST(testGraphicsPresets);
|
||||
//CPPUNIT_TEST(testGroundRadar); // Not registered yet.
|
||||
CPPUNIT_TEST(testGUIMgr);
|
||||
CPPUNIT_TEST(testHighlight);
|
||||
//CPPUNIT_TEST(testInstrumentGroup); // Not registered yet.
|
||||
CPPUNIT_TEST(testLogic);
|
||||
//CPPUNIT_TEST(testNavDisplay); // Not registered yet.
|
||||
//CPPUNIT_TEST(testNewGUI); // double free or corruption (fasttop): 0x000000000701d950
|
||||
//CPPUNIT_TEST(testNoaaMetarRealWxController); // Not registered yet.
|
||||
CPPUNIT_TEST(testPerformanceDB);
|
||||
CPPUNIT_TEST(testPIDController);
|
||||
CPPUNIT_TEST(testPISimpleController);
|
||||
//CPPUNIT_TEST(testPitotSystem); // Not registered yet.
|
||||
CPPUNIT_TEST(testPredictor);
|
||||
CPPUNIT_TEST(testSGEventMgr);
|
||||
//CPPUNIT_TEST(testSGPerformanceMonitor); // Not registered yet.
|
||||
CPPUNIT_TEST(testSGSoundMgr);
|
||||
CPPUNIT_TEST(testSGTerraSync);
|
||||
//CPPUNIT_TEST(testStateMachineComponent); // Not registered yet.
|
||||
//CPPUNIT_TEST(testStaticSystem); // Not registered yet.
|
||||
//CPPUNIT_TEST(testTimeManager); // Segfault.
|
||||
//CPPUNIT_TEST(testVacuumSystem); // Not registered yet.
|
||||
//CPPUNIT_TEST(testView); // Not registered yet.
|
||||
//CPPUNIT_TEST(testwxRadarBg); // Not registered yet.
|
||||
//CPPUNIT_TEST(testYASim); // Not registered yet.
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
// Set up function for each test.
|
||||
void setUp();
|
||||
|
||||
// Clean up after each test.
|
||||
void tearDown();
|
||||
|
||||
// The subsystem tests.
|
||||
void testagRadar();
|
||||
void testAirportDynamicsManager();
|
||||
void testAreaSampler();
|
||||
void testAutopilot();
|
||||
void testCanvasMgr();
|
||||
void testCockpitDisplayManager();
|
||||
void testDigitalFilter();
|
||||
void testEphemeris();
|
||||
void testErrorReporter();
|
||||
void testFDMShell();
|
||||
void testFGACMS();
|
||||
void testFGADA();
|
||||
void testFGAIManager();
|
||||
void testFGAircraftModel();
|
||||
void testFGATCManager();
|
||||
void testFGBalloonSim();
|
||||
void testFGCom();
|
||||
void testFGControls();
|
||||
void testFGDNSClient();
|
||||
void testFGElectricalSystem();
|
||||
void testFGEnvironmentMgr();
|
||||
void testFGExternalNet();
|
||||
void testFGExternalPipe();
|
||||
void testFGFlightHistory();
|
||||
void testFGHIDEventInput();
|
||||
void testFGHTTPClient();
|
||||
void testFGHttpd();
|
||||
void testFGInput();
|
||||
void testFGInstrumentMgr();
|
||||
void testFGInterpolator();
|
||||
void testFGIO();
|
||||
void testFGJoystickInput();
|
||||
void testFGJSBsim();
|
||||
void testFGKeyboardInput();
|
||||
void testFGLaRCsim();
|
||||
void testFGLight();
|
||||
void testFGLinuxEventInput();
|
||||
void testFGLogger();
|
||||
void testFGMacOSXEventInput();
|
||||
void testFGMagicCarpet();
|
||||
void testFGMagVarManager();
|
||||
void testFGModelMgr();
|
||||
void testFGMouseInput();
|
||||
void testFGMultiplayMgr();
|
||||
void testFGNasalSys();
|
||||
void testFGNullFDM();
|
||||
void testFGPanel();
|
||||
void testFGPrecipitationMgr();
|
||||
void testFGProperties();
|
||||
void testFGReplay();
|
||||
void testFGRidgeLift();
|
||||
void testFGRouteMgr();
|
||||
void testFGScenery();
|
||||
void testFGSoundManager();
|
||||
void testFGSubmodelMgr();
|
||||
void testFGSystemMgr();
|
||||
void testFGTrafficManager();
|
||||
void testFGUFO();
|
||||
void testFGViewMgr();
|
||||
void testFGVoiceMgr();
|
||||
void testFGXMLAutopilotGroup();
|
||||
void testFlipFlop();
|
||||
void testGraphicsPresets();
|
||||
void testGroundRadar();
|
||||
void testGUIMgr();
|
||||
void testHighlight();
|
||||
void testInstrumentGroup();
|
||||
void testLogic();
|
||||
void testNavDisplay();
|
||||
void testNewGUI();
|
||||
void testNoaaMetarRealWxController();
|
||||
void testPerformanceDB();
|
||||
void testPIDController();
|
||||
void testPISimpleController();
|
||||
void testPitotSystem();
|
||||
void testPredictor();
|
||||
void testSGEventMgr();
|
||||
void testSGPerformanceMonitor();
|
||||
void testSGSoundMgr();
|
||||
void testSGTerraSync();
|
||||
void testStateMachineComponent();
|
||||
void testStaticSystem();
|
||||
void testTimeManager();
|
||||
void testVacuumSystem();
|
||||
void testView();
|
||||
void testwxRadarBg();
|
||||
void testYASim();
|
||||
|
||||
private:
|
||||
// The subsystem manager.
|
||||
std::unique_ptr<SGSubsystemMgr> _mgr;
|
||||
|
||||
// Helper functions.
|
||||
void create(const char* name);
|
||||
};
|
||||
|
||||
#endif // _FG_NONINSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX
|
|
@ -49,7 +49,7 @@ void AIFlightPlanTests::setUp()
|
|||
FGTestApi::setUp::initTestGlobals("AI");
|
||||
FGTestApi::setUp::initNavDataCache();
|
||||
|
||||
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->get_subsystem_mgr()->add<FGAIManager>();
|
||||
|
||||
auto props = globals->get_props();
|
||||
props->setBoolValue("sim/ai/enabled", true);
|
||||
|
|
|
@ -45,7 +45,7 @@ void AIManagerTests::setUp()
|
|||
FGTestApi::setUp::initTestGlobals("AI");
|
||||
FGTestApi::setUp::initNavDataCache();
|
||||
|
||||
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->get_subsystem_mgr()->add<FGAIManager>();
|
||||
|
||||
auto props = globals->get_props();
|
||||
props->setBoolValue("sim/ai/enabled", true);
|
||||
|
|
|
@ -55,13 +55,13 @@ void TrafficMgrTests::tearDown()
|
|||
}
|
||||
|
||||
void TrafficMgrTests::testParse() {
|
||||
globals->add_new_subsystem<FGTrafficManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->get_subsystem_mgr()->add<FGTrafficManager>();
|
||||
|
||||
globals->get_subsystem_mgr()->bind();
|
||||
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++)
|
||||
|
@ -107,7 +107,7 @@ void TrafficMgrTests::testTrafficManager()
|
|||
|
||||
FGTestApi::setPositionAndStabilise(egeo->geod());
|
||||
|
||||
auto tmgr = globals->add_new_subsystem<FGTrafficManager>(SGSubsystemMgr::GENERAL);
|
||||
auto tmgr = globals->get_subsystem_mgr()->add<FGTrafficManager>();
|
||||
|
||||
tmgr->bind();
|
||||
tmgr->init();
|
||||
|
|
|
@ -68,10 +68,10 @@ void GroundnetTests::setUp()
|
|||
ybbn->testSuiteInjectGroundnetXML(SGPath::fromUtf8(FG_TEST_SUITE_DATA) / "YBBN.groundnet.xml");
|
||||
|
||||
|
||||
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<FGATCManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->get_subsystem_mgr()->add<PerformanceDB>();
|
||||
globals->get_subsystem_mgr()->add<FGATCManager>();
|
||||
globals->get_subsystem_mgr()->add<FGAIManager>();
|
||||
globals->get_subsystem_mgr()->add<flightgear::AirportDynamicsManager>();
|
||||
|
||||
globals->get_subsystem_mgr()->bind();
|
||||
globals->get_subsystem_mgr()->init();
|
||||
|
|
|
@ -49,8 +49,8 @@ void SubmodelsTests::setUp()
|
|||
props->setBoolValue("sim/ai/enabled", true);
|
||||
props->setStringValue("sim/submodels/path", "Aircraft/Test/submodels.xml");
|
||||
|
||||
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<FGSubmodelMgr>(SGSubsystemMgr::GENERAL);
|
||||
globals->get_subsystem_mgr()->add<FGAIManager>();
|
||||
globals->get_subsystem_mgr()->add<FGSubmodelMgr>();
|
||||
|
||||
globals->get_subsystem_mgr()->bind();
|
||||
globals->get_subsystem_mgr()->init();
|
||||
|
|
|
@ -89,11 +89,11 @@ void TrafficTests::setUp()
|
|||
FGAirportRef ybbn = FGAirport::getByIdent("YBBN");
|
||||
ybbn->testSuiteInjectGroundnetXML(SGPath::fromUtf8(FG_TEST_SUITE_DATA) / "YBBN.groundnet.xml");
|
||||
|
||||
globals->add_new_subsystem<PerformanceDB>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<FGATCManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<FGAIManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<flightgear::AirportDynamicsManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->add_new_subsystem<FGTrafficManager>(SGSubsystemMgr::GENERAL);
|
||||
globals->get_subsystem_mgr()->add<PerformanceDB>();
|
||||
globals->get_subsystem_mgr()->add<FGATCManager>();
|
||||
globals->get_subsystem_mgr()->add<FGAIManager>();
|
||||
globals->get_subsystem_mgr()->add<flightgear::AirportDynamicsManager>();
|
||||
globals->get_subsystem_mgr()->add<FGTrafficManager>();
|
||||
|
||||
globals->get_subsystem_mgr()->bind();
|
||||
globals->get_subsystem_mgr()->init();
|
||||
|
|
|
@ -56,7 +56,7 @@ void DigitalFilterTests::testNoise()
|
|||
|
||||
auto ap = new FGXMLAutopilot::Autopilot(globals->get_props(), config);
|
||||
|
||||
globals->add_subsystem("ap", ap, SGSubsystemMgr::FDM);
|
||||
globals->get_subsystem_mgr()->add("ap", ap);
|
||||
ap->bind();
|
||||
ap->init();
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void PidControllerTests::test(bool startup_current)
|
|||
|
||||
auto ap = new FGXMLAutopilot::Autopilot(globals->get_props(), config);
|
||||
|
||||
globals->add_subsystem("ap", ap, SGSubsystemMgr::FDM);
|
||||
globals->get_subsystem_mgr()->add("ap", ap);
|
||||
ap->bind();
|
||||
ap->init();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue