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.
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?
// 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
}
+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
// 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();
}
}