fgAPDataPtr APData;
APData = APDataGlobal;
- // end section
// heading hold enabled?
- return( APData->heading_hold );
+ return APData->heading_hold;
}
+
bool fgAPAltitudeEnabled( void )
{
fgAPDataPtr APData;
APData = APDataGlobal;
- // end section
// altitude hold or terrain follow enabled?
- return( APData->altitude_hold || APData->terrain_follow );
+ return APData->altitude_hold || APData->terrain_follow ;
+}
+
+bool fgAPAutoThrottleEnabled( void )
+{
+ fgAPDataPtr APData;
+
+ APData = APDataGlobal;
+
+ // autothrottle enabled?
+ return APData->auto_throttle;
}
+
void fgAPAltitudeAdjust( double inc )
{
// Remove at a later date
target_agl *= FEET_TO_METER;
}
- // heading hold enabled?
APData->TargetAltitude = target_alt;
APData->TargetAGL = target_agl;
}
+
void fgAPHeadingAdjust( double inc )
{
fgAPDataPtr APData;
-
APData = APDataGlobal;
- // end section
-
- // heading hold enabled?
- APData->TargetHeading = NormalizeDegrees(APData->TargetHeading + inc);
+
+ double target = (int)(APData->TargetHeading / inc) * inc + inc;
+
+ APData->TargetHeading = NormalizeDegrees(target);
+}
+
+void fgAPAutoThrottleAdjust( double inc )
+{
+ fgAPDataPtr APData;
+ APData = APDataGlobal;
+
+ double target = (int)(APData->TargetSpeed / inc) * inc + inc;
+
+ APData->TargetSpeed = target;
}
void fgAPInit( fgAIRCRAFT *current_aircraft )
// $Log$
+// Revision 1.15 1999/02/12 23:22:35 curt
+// Allow auto-throttle adjustment while active.
+//
// Revision 1.14 1999/02/12 22:17:14 curt
// Changes contributed by Norman Vine to allow adjustment of the autopilot
// while it is activated.
bool fgAPAltitudeEnabled( void );
bool fgAPHeadingEnabled( void );
+bool fgAPAutoThrottleEnabled( void );
void fgAPAltitudeAdjust( double inc );
void fgAPHeadingAdjust( double inc );
+void fgAPAutoThrottleAdjust( double inc );
#endif // _AUTOPILOT_HXX
// $Log$
+// Revision 1.9 1999/02/12 23:22:36 curt
+// Allow auto-throttle adjustment while active.
+//
// Revision 1.8 1999/02/12 22:17:15 curt
// Changes contributed by Norman Vine to allow adjustment of the autopilot
// while it is activated.
controls.set_rudder(0.0);
return;
case 57: // numeric keypad 9 (Pg Up)
- controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
+ if( fgAPAutoThrottleEnabled() ) {
+ fgAPAutoThrottleAdjust( 5 );
+ } else {
+ controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
+ }
return;
case 51: // numeric keypad 3 (Pg Dn)
- controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
+ if( fgAPAutoThrottleEnabled() ) {
+ fgAPAutoThrottleAdjust( -5 );
+ } else {
+ controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
+ }
return;
case 98: // b key
int b_ret;
controls.set_rudder(0.0);
return;
case GLUT_KEY_PAGE_UP: // numeric keypad 9 (Pg Up)
- controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
+ if( fgAPAutoThrottleEnabled() ) {
+ fgAPAutoThrottleAdjust( 5 );
+ } else {
+ controls.move_throttle( FGControls::ALL_ENGINES, 0.01 );
+ }
return;
case GLUT_KEY_PAGE_DOWN: // numeric keypad 3 (Pg Dn)
- controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
+ if( fgAPAutoThrottleEnabled() ) {
+ fgAPAutoThrottleAdjust( -5 );
+ } else {
+ controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
+ }
return;
}
}
// $Log$
+// Revision 1.41 1999/02/12 23:22:43 curt
+// Allow auto-throttle adjustment while active.
+//
// Revision 1.40 1999/02/12 22:17:59 curt
// Changes to allow adjustment of the autopilot settings while it is activated.
//