]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/main.cxx
Roy Vegard Ovesen:
[flightgear.git] / src / Main / main.cxx
index 8f80effbba949e28f61347de4187d60366f2feba..103fb951bb3a4a55f8da7fdc8598790dfceb75aa 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started May 1997.
 //
-// Copyright (C) 1997 - 2002  Curtis L. Olson  - curt@flightgear.org
+// Copyright (C) 1997 - 2002  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
 
 #include <Include/general.hxx>
 #include <Cockpit/cockpit.hxx>
-#include <Cockpit/radiostack.hxx>
 #include <Cockpit/hud.hxx>
 #include <Model/panelnode.hxx>
 #include <Model/modelmgr.hxx>
 #include <Model/acmodel.hxx>
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
+#include <Sound/beacon.hxx>
+#include <Sound/morse.hxx>
 #include <FDM/flight.hxx>
 #include <FDM/UIUCModel/uiuc_aircraftdir.h>
-#include <FDM/ADA.hxx>
+// #include <FDM/ADA.hxx>
 #include <ATC/ATCdisplay.hxx>
 #include <ATC/ATCmgr.hxx>
 #include <ATC/AIMgr.hxx>
@@ -110,7 +111,6 @@ FGGeneral general;
 int idle_state = 0;
 long global_multi_loop;
 
-
 SGTimeStamp last_time_stamp;
 SGTimeStamp current_time_stamp;
 
@@ -185,8 +185,6 @@ void fgUpdateTimeDepCalcs() {
                                   globals->get_time_params()->getLst(),
                                   cur_fdm_state->get_Latitude() );
 
-    // Update radio stack model
-    current_radiostack->update(delta_time_sec);
 }
 
 
@@ -217,7 +215,7 @@ static void fgMainLoop( void ) {
     // static const SGPropertyNode *replay_master
     //     = fgGetNode("/sim/freeze/replay", true);
 
-    SGCloudLayer::enable_bump_mapping = fgGetBool("/sim/rendering/bump-mapping",true);
+    SGCloudLayer::enable_bump_mapping = fgGetBool("/sim/rendering/bump-mapping");
 
     // Update the elapsed time.
     static bool first_time = true;
@@ -241,6 +239,18 @@ static void fgMainLoop( void ) {
 
     real_delta_time_sec
         = double(current_time_stamp - last_time_stamp) / 1000000.0;
+    // round the real time down to a multiple of 1/model-hz.
+    // this way all systems are updated the _same_ amount of dt.
+    {
+      static double rem = 0.0;
+      real_delta_time_sec += rem;
+      double hz = model_hz;
+      double nit = floor(real_delta_time_sec*hz);
+      rem = real_delta_time_sec - nit/hz;
+      real_delta_time_sec = nit/hz;
+    }
+
+
     if ( clock_freeze->getBoolValue() ) {
         delta_time_sec = 0;
     } else {
@@ -722,6 +732,8 @@ bool fgMainInit( int argc, char **argv ) {
         exit(-1);
     }
 
+    sgUseDisplayList = fgGetBool( "/sim/rendering/use-display-list", true );
+
     // Initialize the Aircraft directory to "" (UIUC)
     aircraft_dir = "";
 
@@ -938,13 +950,8 @@ bool fgMainInit( int argc, char **argv ) {
     // build our custom render states
     globals->get_renderer()->build_states();
 
-    try {
-        // pass control off to the master event handler
-        fgOSMainLoop();
-    } catch (...) {
-        SG_LOG( SG_ALL, SG_ALERT,
-            "Unknown exception in the main loop. Aborting..." );
-    }
+    // pass control off to the master event handler
+    fgOSMainLoop();
 
     // we never actually get here ... but to avoid compiler warnings,
     // etc.