]> git.mxchange.org Git - flightgear.git/blobdiff - src/Replay/replay.cxx
The code to find the highest hit below you didn't work quite right when
[flightgear.git] / src / Replay / replay.cxx
index 88fc737072fc9300a55d497b22db5c0bb2cf3834..38ebe9e2566238ced5d3392739e2dcef2600593f 100644 (file)
@@ -280,8 +280,14 @@ static FGReplayData interpolate( double time, FGReplayData f1, FGReplayData f2 )
 
     // Gear status
     for ( i = 0; i < fdm1.num_wheels; ++i ) {
-        result.fdm.wow[i]
-            = weight( fdm1.wow[i], fdm2.wow[i], ratio );
+        result.fdm.wow[i] = weight( fdm1.wow[i], fdm2.wow[i], ratio );
+        result.fdm.gear_pos[i]
+            = weight( fdm1.gear_pos[i], fdm2.gear_pos[i], ratio );
+        result.fdm.gear_steer[i]
+            = weight( fdm1.gear_steer[i], fdm2.gear_steer[i], ratio );
+        result.fdm.gear_compression[i]
+            = weight( fdm1.gear_compression[i], fdm2.gear_compression[i],
+                      ratio );
     }
 
     // Environment
@@ -309,8 +315,8 @@ static FGReplayData interpolate( double time, FGReplayData f1, FGReplayData f2 )
         = weight( ctrls1.elevator_trim, ctrls2.elevator_trim, ratio );
     result.ctrls.rudder = weight( ctrls1.rudder, ctrls2.rudder, ratio );
     result.ctrls.flaps = weight( ctrls1.flaps, ctrls2.flaps, ratio );
-    result.ctrls.flaps_power
-        = weight( ctrls1.flaps_power, ctrls2.flaps_power, ratio );
+    result.ctrls.flaps_power = ctrls1.flaps_power;
+    result.ctrls.flap_motor_ok = ctrls1.flap_motor_ok;
 
     // Engine controls
     for ( i = 0; i < ctrls1.num_engines; ++i ) {
@@ -323,6 +329,12 @@ static FGReplayData interpolate( double time, FGReplayData f1, FGReplayData f2 )
         result.ctrls.fuel_pump_power[i] = ctrls1.fuel_pump_power[i];
         result.ctrls.prop_advance[i]
             = weight( ctrls1.prop_advance[i], ctrls2.prop_advance[i], ratio );
+        result.ctrls.engine_ok[i] = ctrls1.engine_ok[i];
+        result.ctrls.mag_left_ok[i] = ctrls1.mag_left_ok[i];
+        result.ctrls.mag_right_ok[i] = ctrls1.mag_right_ok[i];
+        result.ctrls.spark_plugs_ok[i] = ctrls1.spark_plugs_ok[i];
+        result.ctrls.oil_press_status[i] = ctrls1.oil_press_status[i];
+        result.ctrls.fuel_pump_ok[i] = ctrls1.fuel_pump_ok[i];
     }
 
     // Fuel management
@@ -366,7 +378,7 @@ static FGReplayData interpolate( double time, FGReplayData f1, FGReplayData f2 )
 /** 
  * interpolate a specific time from a specific list
  */
-static void interpolate( double time, replay_list_type list ) {
+static void interpolate( double time, const replay_list_type &list ) {
     // sanity checking
     if ( list.size() == 0 ) {
         // handle empty list
@@ -412,7 +424,7 @@ static void interpolate( double time, replay_list_type list ) {
  */
 
 void FGReplay::replay( double time ) {
-    cout << "replay: " << time << " ";
+    // cout << "replay: " << time << " ";
     // find the two frames to interpolate between
     double t1, t2;
 
@@ -422,10 +434,10 @@ void FGReplay::replay( double time ) {
         if ( time > t1 ) {
             // replay the most recent frame
             update_fdm( short_term.back() );
-            cout << "first frame" << endl;
+            // cout << "first frame" << endl;
         } else if ( time <= t1 && time >= t2 ) {
             interpolate( time, short_term );
-            cout << "from short term" << endl;
+            // cout << "from short term" << endl;
         } else if ( medium_term.size() > 0 ) {
             t1 = short_term.front().sim_time;
             t2 = medium_term.back().sim_time;
@@ -434,13 +446,13 @@ void FGReplay::replay( double time ) {
                                                    medium_term.back(),
                                                    short_term.front() );
                 update_fdm( result );
-                cout << "from short/medium term" << endl;
+                // cout << "from short/medium term" << endl;
             } else {
                 t1 = medium_term.back().sim_time;
                 t2 = medium_term.front().sim_time;
                 if ( time <= t1 && time >= t2 ) {
                     interpolate( time, medium_term );
-                    cout << "from medium term" << endl;
+                    // cout << "from medium term" << endl;
                 } else if ( long_term.size() > 0 ) {
                     t1 = medium_term.front().sim_time;
                     t2 = long_term.back().sim_time;
@@ -449,29 +461,29 @@ void FGReplay::replay( double time ) {
                                                            long_term.back(),
                                                            medium_term.front());
                         update_fdm( result );
-                       cout << "from medium/long term" << endl;
+                        // cout << "from medium/long term" << endl;
                     } else {
                         t1 = long_term.back().sim_time;
                         t2 = long_term.front().sim_time;
                         if ( time <= t1 && time >= t2 ) {
                             interpolate( time, long_term );
-                            cout << "from long term" << endl;
+                            // cout << "from long term" << endl;
                         } else {
                             // replay the oldest long term frame
                             update_fdm( long_term.front() );
-                            cout << "oldest long term frame" << endl;
+                            // cout << "oldest long term frame" << endl;
                         }
                     }
                 } else {
                     // replay the oldest medium term frame
                     update_fdm( medium_term.front() );
-                    cout << "oldest medium term frame" << endl;
+                    // cout << "oldest medium term frame" << endl;
                 }
             }
         } else {
             // replay the oldest short term frame
             update_fdm( short_term.front() );
-            cout << "oldest short term frame" << endl;
+            // cout << "oldest short term frame" << endl;
         }
     } else {
         // nothing to replay