AICarrier: clamp bug fix.
Since this code attempts to clamp values between 0.0 and 1.0, the comparision needs to occur using double types.
This commit is contained in:
parent
f008531fd5
commit
3c4220e784
1 changed files with 9 additions and 8 deletions
|
@ -712,11 +712,12 @@ void FGAICarrier::UpdateElevator(double dt) {
|
||||||
_elevator_pos_norm = (_elevator_pos_norm_raw * _elevator_time_constant) + (_elevator_pos_norm * (1 - _elevator_time_constant));
|
_elevator_pos_norm = (_elevator_pos_norm_raw * _elevator_time_constant) + (_elevator_pos_norm * (1 - _elevator_time_constant));
|
||||||
|
|
||||||
//sanitise the output
|
//sanitise the output
|
||||||
if (_elevator_pos_norm_raw >= 1) {
|
if (_elevator_pos_norm_raw >= 1.0) {
|
||||||
_elevator_pos_norm_raw = 1;
|
_elevator_pos_norm_raw = 1.0;
|
||||||
} else if (_elevator_pos_norm_raw <= 0) {
|
} else if (_elevator_pos_norm_raw <= 0.0) {
|
||||||
_elevator_pos_norm_raw = 0;
|
_elevator_pos_norm_raw = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} // end UpdateElevator
|
} // end UpdateElevator
|
||||||
|
@ -754,10 +755,10 @@ void FGAICarrier::UpdateJBD(double dt) {
|
||||||
_jbd_elevator_pos_norm = (_jbd_elevator_pos_norm_raw * _jbd_time_constant) + (_jbd_elevator_pos_norm * (1 - _jbd_time_constant));
|
_jbd_elevator_pos_norm = (_jbd_elevator_pos_norm_raw * _jbd_time_constant) + (_jbd_elevator_pos_norm * (1 - _jbd_time_constant));
|
||||||
|
|
||||||
//sanitise the output
|
//sanitise the output
|
||||||
if (_jbd_elevator_pos_norm >= 1) {
|
if (_jbd_elevator_pos_norm >= 1.0) {
|
||||||
_jbd_elevator_pos_norm = 1;
|
_jbd_elevator_pos_norm = 1.0;
|
||||||
} else if (_jbd_elevator_pos_norm <= 0) {
|
} else if (_jbd_elevator_pos_norm <= 0.0) {
|
||||||
_jbd_elevator_pos_norm = 0;
|
_jbd_elevator_pos_norm = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue