]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_commands.cxx
Frederic Bouvier:
[flightgear.git] / src / Main / fg_commands.cxx
index 2e20d8830846f3e06a17f79fc552a3dc3d92fa66..0efd3c09d86236000cfc73d64d1cc05e5f0a88cd 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "fg_init.hxx"
 #include "fg_commands.hxx"
+#include "fg_props.hxx"
 
 SG_USING_STD(string);
 SG_USING_STD(ifstream);
@@ -829,15 +830,18 @@ static bool
 do_replay (const SGPropertyNode * arg)
 {
     // freeze the master fdm
-    fgSetBool( "/sim/freeze/master", true );
-    fgSetBool( "/sim/freeze/clock", true );
-    fgSetBool( "/sim/replay/master", true );
+    fgSetBool( "/sim/freeze/replay", true );
 
     FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" ));
 
     fgSetDouble( "/sim/replay/start-time", r->get_start_time() );
     fgSetDouble( "/sim/replay/end-time", r->get_end_time() );
-    fgSetDouble( "/sim/replay/time", r->get_start_time() );
+    double duration = fgGetDouble( "/sim/replay/duration" );
+    if( duration && duration < (r->get_end_time() - r->get_start_time()) ) {
+        fgSetDouble( "/sim/replay/time", r->get_end_time() - duration );
+    } else {
+        fgSetDouble( "/sim/replay/time", r->get_start_time() );
+    }
 
     cout << "start = " << r->get_start_time()
          << "  end = " << r->get_end_time() << endl;
@@ -847,7 +851,29 @@ do_replay (const SGPropertyNode * arg)
 
 
 
-\f
+static bool
+do_decrease_visibility (const SGPropertyNode * arg)
+{
+    double new_value = fgGetDouble("/environment/visibility-m") * 0.9;
+    fgSetDouble("/environment/visibility-m", new_value);
+    fgDefaultWeatherValue("visibility-m", new_value);
+    globals->get_subsystem("environment")->reinit();
+
+    return true;
+}
+static bool
+do_increase_visibility (const SGPropertyNode * arg)
+{
+    double new_value = fgGetDouble("/environment/visibility-m") * 1.1;
+    fgSetDouble("/environment/visibility-m", new_value);
+    fgDefaultWeatherValue("visibility-m", new_value);
+    globals->get_subsystem("environment")->reinit();
+
+    return true;
+}
+
+
 ////////////////////////////////////////////////////////////////////////
 // Command setup.
 ////////////////////////////////////////////////////////////////////////
@@ -896,6 +922,8 @@ static struct {
     { "presets-commit", do_presets_commit },
     { "log-level", do_log_level },
     { "replay", do_replay },
+    { "decrease-visibility", do_decrease_visibility },
+    { "increase-visibility", do_increase_visibility },
     { 0, 0 }                   // zero-terminated
 };