]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_commands.cxx
Cleanup: don't unbind unknown properties
[flightgear.git] / src / Main / fg_commands.cxx
index 46c6851b376bf458e1120ed9503bba5b47199a6f..a8c45e99962748cfddf5a22677f499b5641c13c7 100644 (file)
@@ -31,7 +31,6 @@
 #include <GUI/new_gui.hxx>
 #include <GUI/dialog.hxx>
 #include <Aircraft/replay.hxx>
-#include <Scenery/tilemgr.hxx>
 #include <Scenery/scenery.hxx>
 #include <Scripting/NasalSys.hxx>
 #include <Sound/sample_queue.hxx>
@@ -518,6 +517,13 @@ do_dump_terrain_branch (const SGPropertyNode*)
     return true;
 }
 
+static bool
+do_print_visible_scene_info(const SGPropertyNode*)
+{
+    fgPrintVisibleSceneInfoCommand();
+    return true;
+}
+
 /**
  * Built-in command: hires capture screen.
  */
@@ -691,8 +697,6 @@ do_timeofday (const SGPropertyNode * arg)
         = fgGetNode("/position/longitude-deg");
     static const SGPropertyNode *latitude
         = fgGetNode("/position/latitude-deg");
-    static const SGPropertyNode *cur_time_override
-        = fgGetNode("/sim/time/cur-time-override", true);
 
     int orig_warp = globals->get_warp();
     SGTime *t = globals->get_time_params();
@@ -753,14 +757,10 @@ do_timeofday (const SGPropertyNode * arg)
                                              * SGD_DEGREES_TO_RADIANS,
                                            180.0, false ); 
     }
-    // cout << "warp = " << warp << endl;
-    globals->set_warp( orig_warp + warp );
-
-    t->update( longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS,
-               latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS,
-               cur_time_override->getLongValue(),
-               globals->get_warp() );
+    
 
+    fgSetInt("/sim/time/warp", orig_warp + warp);
+    
     return true;
 }
 
@@ -1211,7 +1211,15 @@ do_play_audio_sample (const SGPropertyNode * arg)
 static bool
 do_presets_commit (const SGPropertyNode * arg)
 {
-    fgReInitSubsystems();
+    if (fgGetBool("/sim/initialized", false)) {
+      fgReInitSubsystems();
+    } else {
+      // Nasal can trigger this during initial init, which confuses
+      // the logic in ReInitSubsystems, since initial state has not been
+      // saved at that time. Short-circuit everything here.
+      fgInitPosition();
+    }
+    
     return true;
 }
 
@@ -1480,6 +1488,7 @@ static struct {
     { "release-cockpit-button", do_release_cockpit_button },
     { "dump-scenegraph", do_dump_scene_graph },
     { "dump-terrainbranch", do_dump_terrain_branch },
+    { "print-visible-scene", do_print_visible_scene_info },
     { "reload-shaders", do_reload_shaders },
     { 0, 0 }                   // zero-terminated
 };