*/
void FGReplay::update( double dt ) {
- static SGPropertyNode *replay_master = fgGetNode( "/sim/freeze/replay" );
+ static SGPropertyNode *replay_master
+ = fgGetNode( "/sim/freeze/replay", true );
if ( replay_master->getBoolValue() ) {
// don't record the replay session
result.fdm.rpm[i] = weight( fdm1.rpm[i], fdm2.rpm[i], ratio );
result.fdm.fuel_flow[i]
= weight( fdm1.fuel_flow[i], fdm2.fuel_flow[i], ratio );
- result.fdm.EGT[i] = weight( fdm1.EGT[i], fdm2.EGT[i], ratio );
+ result.fdm.egt[i] = weight( fdm1.egt[i], fdm2.egt[i], ratio );
+ result.fdm.mp_osi[i] = weight( fdm1.mp_osi[i], fdm2.mp_osi[i], ratio );
result.fdm.oil_temp[i]
= weight( fdm1.oil_temp[i], fdm2.oil_temp[i], ratio );
result.fdm.oil_px[i] = weight( fdm1.oil_px[i], fdm2.oil_px[i], ratio );
// Control surface positions (normalized values)
result.fdm.elevator = weight( fdm1.elevator, fdm2.elevator, ratio );
- result.fdm.flaps = weight( fdm1.flaps, fdm2.flaps, ratio );
+ result.fdm.left_flap = weight( fdm1.left_flap, fdm2.left_flap, ratio );
+ result.fdm.right_flap = weight( fdm1.right_flap, fdm2.right_flap, ratio );
result.fdm.left_aileron
= weight( fdm1.left_aileron, fdm2.left_aileron, ratio );
result.fdm.right_aileron
= 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 ) {
+ result.ctrls.master_bat[i] = ctrls1.master_bat[i];
+ result.ctrls.master_alt[i] = ctrls1.master_alt[i];
result.ctrls.magnetos[i] = ctrls1.magnetos[i];
result.ctrls.starter_power[i] = ctrls1.starter_power[i];
result.ctrls.throttle[i]
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
}
// Brake controls
- for ( i = 0; i < ctrls1.num_wheels; ++i ) {
- result.ctrls.brake[i]
- = weight( ctrls1.brake[i], ctrls2.brake[i], ratio );
- }
+ result.ctrls.brake_left
+ = weight( ctrls1.brake_left, ctrls2.brake_right, ratio );
+ result.ctrls.brake_right
+ = weight( ctrls1.brake_right, ctrls2.brake_right, ratio );
+ result.ctrls.brake_parking
+ = weight( ctrls1.brake_parking, ctrls2.brake_parking, ratio );
// Landing Gear
result.ctrls.gear_handle = ctrls1.gear_handle;
// Switches
- result.ctrls.master_bat = ctrls1.master_bat;
- result.ctrls.master_alt = ctrls1.master_alt;
result.ctrls.turbulence_norm = ctrls1.turbulence_norm;
// wind and turbulance
/**
* 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
*/
void FGReplay::replay( double time ) {
- cout << "replay: " << time << " ";
+ // cout << "replay: " << time << " ";
// find the two frames to interpolate between
double t1, t2;
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;
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;
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