From 29b514747879c565c7ecf2256ba57e6837ac5845 Mon Sep 17 00:00:00 2001 From: ehofman Date: Fri, 22 Oct 2004 09:58:24 +0000 Subject: [PATCH] Move the submodels code from the Systems manager into it's own Subsystem manager. --- src/AIModel/Makefile.am | 1 + src/{Systems => AIModel}/submodel.cxx | 22 +++++++++++----------- src/{Systems => AIModel}/submodel.hxx | 6 +++--- src/Main/fg_init.cxx | 2 ++ src/Systems/Makefile.am | 3 +-- src/Systems/system_mgr.cxx | 2 -- 6 files changed, 18 insertions(+), 18 deletions(-) rename src/{Systems => AIModel}/submodel.cxx (96%) rename src/{Systems => AIModel}/submodel.hxx (97%) diff --git a/src/AIModel/Makefile.am b/src/AIModel/Makefile.am index 54bff8b5e..d3429a8ca 100644 --- a/src/AIModel/Makefile.am +++ b/src/AIModel/Makefile.am @@ -1,6 +1,7 @@ noinst_LIBRARIES = libAIModel.a libAIModel_a_SOURCES = \ + submodel.cxx submodel.hxx \ AIManager.hxx AIManager.cxx \ AIBase.hxx AIBase.cxx \ AIAircraft.hxx AIAircraft.cxx \ diff --git a/src/Systems/submodel.cxx b/src/AIModel/submodel.cxx similarity index 96% rename from src/Systems/submodel.cxx rename to src/AIModel/submodel.cxx index e35d6554e..a9992885b 100644 --- a/src/Systems/submodel.cxx +++ b/src/AIModel/submodel.cxx @@ -13,9 +13,9 @@ #include -const double SubmodelSystem::lbs_to_slugs = 0.031080950172; +const double FGSubmodelMgr::lbs_to_slugs = 0.031080950172; -SubmodelSystem::SubmodelSystem () +FGSubmodelMgr::FGSubmodelMgr () { x_offset = y_offset = 0.0; @@ -28,12 +28,12 @@ SubmodelSystem::SubmodelSystem () string contents_node; } -SubmodelSystem::~SubmodelSystem () +FGSubmodelMgr::~FGSubmodelMgr () { } void -SubmodelSystem::init () +FGSubmodelMgr::init () { load(); _serviceable_node = fgGetNode("/sim/systems/submodels/serviceable", true); @@ -63,12 +63,12 @@ SubmodelSystem::init () } void -SubmodelSystem::bind () +FGSubmodelMgr::bind () { } void -SubmodelSystem::unbind () +FGSubmodelMgr::unbind () { submodel_iterator = submodels.begin(); while(submodel_iterator != submodels.end()) { @@ -78,7 +78,7 @@ SubmodelSystem::unbind () } void -SubmodelSystem::update (double dt) +FGSubmodelMgr::update (double dt) { if (!(_serviceable_node->getBoolValue())) return; int i=-1; @@ -98,7 +98,7 @@ SubmodelSystem::update (double dt) } bool -SubmodelSystem::release (submodel* sm, double dt) +FGSubmodelMgr::release (submodel* sm, double dt) { sm->timer += dt; if (sm->timer < sm->delay) return false; @@ -137,7 +137,7 @@ SubmodelSystem::release (submodel* sm, double dt) } void -SubmodelSystem::load () +FGSubmodelMgr::load () { int i; @@ -205,7 +205,7 @@ SubmodelSystem::load () void -SubmodelSystem::transform( submodel* sm) +FGSubmodelMgr::transform( submodel* sm) { // get initial conditions @@ -335,7 +335,7 @@ SubmodelSystem::transform( submodel* sm) } void -SubmodelSystem::updatelat(double lat) +FGSubmodelMgr::updatelat(double lat) { double latitude = lat; ft_per_deg_latitude = 366468.96 - 3717.12 * cos(latitude / SG_RADIANS_TO_DEGREES); diff --git a/src/Systems/submodel.hxx b/src/AIModel/submodel.hxx similarity index 97% rename from src/Systems/submodel.hxx rename to src/AIModel/submodel.hxx index a0c4dd639..dbddf39fd 100644 --- a/src/Systems/submodel.hxx +++ b/src/AIModel/submodel.hxx @@ -20,7 +20,7 @@ SG_USING_STD(vector); SG_USING_STD(string); -class SubmodelSystem : public SGSubsystem +class FGSubmodelMgr : public SGSubsystem { public: @@ -73,8 +73,8 @@ public: double mass; } IC_struct; - SubmodelSystem (); - ~SubmodelSystem (); + FGSubmodelMgr (); + ~FGSubmodelMgr (); void load (); void init (); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index a425fe67f..961ae9975 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -100,6 +100,7 @@ #include #include #include +#include #include #include #include @@ -1693,6 +1694,7 @@ bool fgInitSubsystems() { //////////////////////////////////////////////////////////////////// SG_LOG(SG_GENERAL, SG_INFO, " AI Model Manager"); globals->add_subsystem("ai_model", new FGAIManager); + globals->add_subsystem("submodel_mgr", new FGSubmodelMgr); // It's probably a good idea to initialize the top level traffic manager diff --git a/src/Systems/Makefile.am b/src/Systems/Makefile.am index c40edae4c..93ff9c946 100644 --- a/src/Systems/Makefile.am +++ b/src/Systems/Makefile.am @@ -5,7 +5,6 @@ libSystems_a_SOURCES = \ electrical.cxx electrical.hxx \ pitot.cxx pitot.hxx \ static.cxx static.hxx \ - vacuum.cxx vacuum.hxx \ - submodel.cxx submodel.hxx + vacuum.cxx vacuum.hxx INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src diff --git a/src/Systems/system_mgr.cxx b/src/Systems/system_mgr.cxx index 21bf3f5cf..1a93aa718 100644 --- a/src/Systems/system_mgr.cxx +++ b/src/Systems/system_mgr.cxx @@ -20,13 +20,11 @@ #include "pitot.hxx" #include "static.hxx" #include "vacuum.hxx" -#include "submodel.hxx" FGSystemMgr::FGSystemMgr () { set_subsystem( "electrical", new FGElectricalSystem ); - set_subsystem( "submodel", new SubmodelSystem() ); config_props = new SGPropertyNode; -- 2.39.5