From e0081b39218bad52be9d0bf583761b0afd483d64 Mon Sep 17 00:00:00 2001 From: Bertrand Coconnier Date: Mon, 30 Dec 2024 15:11:56 +0100 Subject: [PATCH] Fix a few details. --- scripts/c172_cruise_8K.xml | 21 +++++---------------- src/JSBSim.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/scripts/c172_cruise_8K.xml b/scripts/c172_cruise_8K.xml index ef4161e561..5463646ddf 100644 --- a/scripts/c172_cruise_8K.xml +++ b/scripts/c172_cruise_8K.xml @@ -7,7 +7,7 @@ - + simulation/run_id @@ -26,17 +26,17 @@ - + simulation/sim-time-sec ge 0.01 - + - + @@ -103,7 +103,7 @@ simulation/sim-time-sec >= 30.0 - simulation/terminate != 1 + simulation/run_id lt 2 @@ -115,16 +115,5 @@ simulation/run_id - - - - simulation/run_id ge 3 - - - - simulation/terminate - - - diff --git a/src/JSBSim.cpp b/src/JSBSim.cpp index 156e491317..bba2fd81ad 100644 --- a/src/JSBSim.cpp +++ b/src/JSBSim.cpp @@ -397,9 +397,9 @@ int real_main(int argc, char* argv[]) FDMExec->GetPropertyManager()->Tie("simulation/frame_start_time", &actual_elapsed_time); FDMExec->GetPropertyManager()->Tie("simulation/cycle_duration", &cycle_duration); - Timer timer; + auto timer = new Timer; SGPropertyNode_ptr reset_node = FDMExec->GetPropertyManager()->GetNode("simulation/reset"); - reset_node->addChangeListener(&timer); + reset_node->addChangeListener(timer); // Check whether to disable console highlighting output on Windows. // Support was added to Windows for Virtual Terminal codes by a particular @@ -576,7 +576,7 @@ int real_main(int argc, char* argv[]) else sleep_nseconds = (sleep_period )*1e9; // 0.01 seconds tzset(); - timer.start(); + timer->start(); // *** CYCLIC EXECUTION LOOP, AND MESSAGE READING *** // while (result && FDMExec->GetSimTime() <= end_time) { @@ -596,8 +596,8 @@ int real_main(int argc, char* argv[]) if (play_nice) sim_nsleep(sleep_nseconds); } else { // ------------ RUNNING IN REALTIME MODE - timer.pause(false); - actual_elapsed_time = timer.getElapsedTime(); + timer->pause(false); + actual_elapsed_time = timer->getElapsedTime(); double sim_lag_time = actual_elapsed_time - FDMExec->GetSimTime(); // How far behind sim-time is from actual elapsed time. double cycle_start = getcurrentseconds(); @@ -617,7 +617,7 @@ int real_main(int argc, char* argv[]) } } } else { // Suspended - timer.pause(true); + timer->pause(true); sim_nsleep(sleep_nseconds); result = FDMExec->Run(); }