1
0
Fork 0

Remove dependency on command-mgr singleton

Use explicit instance (from globals)
This commit is contained in:
James Turner 2013-11-25 09:14:46 +00:00
parent 69baf3a9d6
commit 4dcd96c4af
5 changed files with 16 additions and 10 deletions

View file

@ -215,7 +215,7 @@ FGRouteMgr::FGRouteMgr() :
input->setStringValue("");
input->addChangeListener(listener);
SGCommandMgr* cmdMgr = SGCommandMgr::instance();
SGCommandMgr* cmdMgr = globals->get_commands();
cmdMgr->addCommand("define-user-waypoint", this, &FGRouteMgr::commandDefineUserWaypoint);
cmdMgr->addCommand("delete-user-waypoint", this, &FGRouteMgr::commandDeleteUserWaypoint);
@ -238,7 +238,7 @@ FGRouteMgr::~FGRouteMgr()
_plan->removeDelegate(this);
}
SGCommandMgr* cmdMgr = SGCommandMgr::instance();
SGCommandMgr* cmdMgr = globals->get_commands();
cmdMgr->removeCommand("define-user-waypoint");
cmdMgr->removeCommand("delete-user-waypoint");
cmdMgr->removeCommand("load-flightplan");

View file

@ -233,14 +233,14 @@ BasicRealWxController::BasicRealWxController( SGPropertyNode_ptr rootNode, Metar
_requester(metarRequester)
{
SGCommandMgr::instance()->addCommand("request-metar", commandRequestMetar);
SGCommandMgr::instance()->addCommand("clear-metar", commandClearMetar);
globals->get_commands()->addCommand("request-metar", commandRequestMetar);
globals->get_commands()->addCommand("clear-metar", commandClearMetar);
}
BasicRealWxController::~BasicRealWxController()
{
SGCommandMgr::instance()->removeCommand("request-metar");
SGCommandMgr::instance()->removeCommand("clear-metar");
globals->get_commands()->removeCommand("request-metar");
globals->get_commands()->removeCommand("clear-metar");
}
void BasicRealWxController::init()

View file

@ -162,7 +162,7 @@ FGPanelNode::FGPanelNode() :
_resizeToViewport(true),
_depthTest(false)
{
SGCommandMgr::instance()->addCommand("panel-mouse-click", this, &FGPanelNode::panelMouseClickCommand);
globals->get_commands()->addCommand("panel-mouse-click", this, &FGPanelNode::panelMouseClickCommand);
SGPropertyNode* pathNode = fgGetNode("/sim/panel/path");
_pathListener.reset(new PanelPathListener(this));
@ -185,7 +185,7 @@ FGPanelNode::FGPanelNode() :
FGPanelNode::~FGPanelNode()
{
if (_is2d) {
SGCommandMgr::instance()->removeCommand("panel-mouse-click");
globals->get_commands()->removeCommand("panel-mouse-click");
SGPropertyNode* pathNode = fgGetNode("/sim/panel/path");
pathNode->removeChangeListener(_pathListener.get());
}

View file

@ -56,7 +56,12 @@ TimeManager::TimeManager() :
_inited(false),
_impl(NULL)
{
SGCommandMgr::instance()->addCommand("timeofday", do_timeofday);
globals->get_commands()->addCommand("timeofday", do_timeofday);
}
TimeManager::~TimeManager()
{
globals->get_commands()->removeCommand("timeofday");
}
void TimeManager::init()

View file

@ -31,7 +31,8 @@ class TimeManager : public SGSubsystem, public SGPropertyChangeListener
{
public:
TimeManager();
virtual ~TimeManager();
void computeTimeDeltas(double& simDt, double& realDt);
virtual void init();