1
0
Fork 0

Remove static subsystem dependencies

preventing us from recreating subsystems on reset/reinit.
This commit is contained in:
ThorstenB 2012-11-18 17:20:11 +01:00
parent d51499382d
commit be3f94f63a
2 changed files with 11 additions and 8 deletions

View file

@ -257,10 +257,7 @@ FGPavement* FGAirport::getPavementByIndex(unsigned int aIndex) const
FGRunway* FGAirport::getActiveRunwayForUsage() const
{
static FGEnvironmentMgr* envMgr = NULL;
if (!envMgr) {
envMgr = (FGEnvironmentMgr *) globals->get_subsystem("environment");
}
FGEnvironmentMgr* envMgr = (FGEnvironmentMgr *) globals->get_subsystem("environment");
// This forces West-facing rwys to be used in no-wind situations
// which is consistent with Flightgear's initial setup.

View file

@ -76,6 +76,7 @@ using std::vector;
extern int _bootstrap_OSInit;
static SGPropertyNode_ptr frame_signal;
static TimeManager* timeMgr;
// What should we do when we have nothing else to do? Let's get ready
// for the next move and update the display?
@ -89,7 +90,6 @@ static void fgMainLoop( void )
// compute simulated time (allowing for pause, warp, etc) and
// real elapsed time
double sim_dt, real_dt;
static TimeManager* timeMgr = (TimeManager*) globals->get_subsystem("time");
timeMgr->computeTimeDeltas(sim_dt, real_dt);
// update all subsystems
@ -101,6 +101,14 @@ static void fgMainLoop( void )
}
static void registerMainLoop()
{
// stash current frame signal property
frame_signal = fgGetNode("/sim/signals/frame", true);
timeMgr = (TimeManager*) globals->get_subsystem("time");
fgRegisterIdleHandler( fgMainLoop );
}
// This is the top level master main function that is registered as
// our idle function
@ -263,9 +271,7 @@ static void fgIdleFunction ( void ) {
// We've finished all our initialization steps, from now on we
// run the main loop.
fgSetBool("sim/sceneryloaded", false);
// stash current frame signal property
frame_signal = fgGetNode("/sim/signals/frame", true);
fgRegisterIdleHandler( fgMainLoop );
registerMainLoop();
}
}