From fff298985370394f780bd980cd4110a44115f55e Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 18 Jul 2003 14:14:24 +0000 Subject: [PATCH] Modified the replay system to work without enabling the master or clock freeze. --- src/Main/fg_commands.cxx | 4 +--- src/Main/main.cxx | 16 ++++++---------- src/Replay/replay.cxx | 7 ++++--- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 2e20d8830..d540faf40 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -829,9 +829,7 @@ 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" )); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index c6dd8cf26..b815d6b14 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -167,7 +167,6 @@ float scene_nearplane = 0.5f; float scene_farplane = 120000.0f; static double delta_time_sec = 0.0; -static double replay_dt_sec = 0.0; #ifdef FG_WEATHERCM @@ -934,8 +933,8 @@ void fgRenderFrame() { void fgUpdateTimeDepCalcs() { static bool inited = false; - static const SGPropertyNode *replay - = fgGetNode( "/sim/replay/master", true ); + static const SGPropertyNode *replay_master + = fgGetNode( "/sim/freeze/replay", true ); static SGPropertyNode *replay_time = fgGetNode( "/sim/replay/time", true ); static const SGPropertyNode *replay_end_time @@ -971,14 +970,14 @@ void fgUpdateTimeDepCalcs() { inited = true; } - if ( ! replay->getBoolValue() ) { + if ( ! replay_master->getBoolValue() ) { globals->get_autopilot()->update(delta_time_sec); cur_fdm_state->update(delta_time_sec); } else { FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" )); r->replay( replay_time->getDoubleValue() ); replay_time->setDoubleValue( replay_time->getDoubleValue() - + replay_dt_sec ); + + delta_time_sec ); } } else { // do nothing, fdm isn't inited yet @@ -1026,8 +1025,8 @@ static void fgMainLoop( void ) { = fgGetNode("/sim/freeze/clock", true); static const SGPropertyNode *cur_time_override = fgGetNode("/sim/time/cur-time-override", true); - static const SGPropertyNode *replay - = fgGetNode("/sim/replay/master", true); + static const SGPropertyNode *replay_master + = fgGetNode("/sim/freeze/replay", true); // Update the elapsed time. static bool first_time = true; @@ -1050,9 +1049,6 @@ static void fgMainLoop( void ) { } delta_time_sec = double(current_time_stamp - last_time_stamp) / 1000000.0; - if ( replay->getBoolValue() ) { - replay_dt_sec = delta_time_sec; - } if ( clock_freeze->getBoolValue() ) { delta_time_sec = 0; } diff --git a/src/Replay/replay.cxx b/src/Replay/replay.cxx index 9b8a44760..e8a978fa9 100644 --- a/src/Replay/replay.cxx +++ b/src/Replay/replay.cxx @@ -24,6 +24,7 @@ #include #include +#include
#include #include #include @@ -101,10 +102,10 @@ void FGReplay::unbind() { */ void FGReplay::update( double dt ) { + static SGPropertyNode *replay_master = fgGetNode( "/sim/freeze/replay" ); - if ( dt <= 0 ) { - // don't save data if nothing is going on ... - + if ( replay_master->getBoolValue() ) { + // don't record the replay session return; } -- 2.39.5