Replay improvements
Clear replay buffers on sim reset. Allow instant replay to be activated properly when sim is paused.
This commit is contained in:
parent
51a6302f48
commit
b6d70d2c71
4 changed files with 17 additions and 5 deletions
|
@ -83,6 +83,14 @@ FGReplay::~FGReplay() {
|
|||
*/
|
||||
|
||||
void FGReplay::init() {
|
||||
reinit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset replay queues.
|
||||
*/
|
||||
|
||||
void FGReplay::reinit() {
|
||||
sim_time = 0.0;
|
||||
last_mt_time = 0.0;
|
||||
last_lt_time = 0.0;
|
||||
|
@ -110,17 +118,16 @@ void FGReplay::init() {
|
|||
(lt_list_time*lt_dt));
|
||||
for (int i = 0; i < estNrObjects; i++) {
|
||||
recycler.push_back(new FGReplayData);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bind to the property tree
|
||||
*/
|
||||
|
||||
void FGReplay::bind() {
|
||||
disable_replay = fgGetNode( "/sim/replay/disable", true );
|
||||
replay_master = fgGetNode( "/sim/freeze/replay-state", true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,8 +147,6 @@ void FGReplay::unbind() {
|
|||
void FGReplay::update( double dt ) {
|
||||
timingInfo.clear();
|
||||
stamp("begin");
|
||||
static SGPropertyNode *replay_master
|
||||
= fgGetNode( "/sim/freeze/replay-state", true );
|
||||
|
||||
if( disable_replay->getBoolValue() ) {
|
||||
if ( sim_time != 0.0 ) {
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
virtual ~FGReplay();
|
||||
|
||||
virtual void init();
|
||||
virtual void reinit();
|
||||
virtual void bind();
|
||||
virtual void unbind();
|
||||
virtual void update( double dt );
|
||||
|
@ -96,6 +97,7 @@ private:
|
|||
replay_list_type long_term;
|
||||
replay_list_type recycler;
|
||||
SGPropertyNode_ptr disable_replay;
|
||||
SGPropertyNode_ptr replay_master;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1243,8 +1243,10 @@ do_log_level (const SGPropertyNode * arg)
|
|||
static bool
|
||||
do_replay (const SGPropertyNode * arg)
|
||||
{
|
||||
// freeze the master fdm
|
||||
// freeze the fdm, resume from sim pause
|
||||
fgSetInt( "/sim/freeze/replay-state", 1 );
|
||||
fgSetBool("/sim/freeze/master", 0 );
|
||||
fgSetBool("/sim/freeze/clock", 0 );
|
||||
|
||||
FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" ));
|
||||
|
||||
|
|
|
@ -1553,6 +1553,9 @@ void fgReInitSubsystems()
|
|||
// Initialize the FDM
|
||||
globals->get_subsystem("flight")->reinit();
|
||||
|
||||
// reset replay buffers
|
||||
globals->get_subsystem("replay")->reinit();
|
||||
|
||||
// reload offsets from config defaults
|
||||
globals->get_viewmgr()->reinit();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue