#ifndef _CONTROLS_HXX
#define _CONTROLS_HXX
-#include <Main/options.hxx>
+#include <simgear/misc/props.hxx>
+
+#include <Main/fgfs.hxx>
+#include <Main/globals.hxx>
#ifndef __cplusplus
# error This library requires C++
// Define a structure containing the control parameters
-class FGControls {
+class FGControls : public FGSubsystem
+{
public:
double brake[MAX_WHEELS];
bool throttle_idle;
+ SGPropertyNode * auto_coordination;
+
inline void CLAMP(double *x, double min, double max ) {
if ( *x < min ) { *x = min; }
if ( *x > max ) { *x = max; }
FGControls();
~FGControls();
+ // Implementation of FGSubsystem.
+ void init ();
+ void bind ();
+ void unbind ();
+ void update ();
+
// Reset function
void reset_all(void);
CLAMP( &aileron, -1.0, 1.0 );
// check for autocoordination
- if ( current_options.get_auto_coordination() ==
- fgOPTIONS::FG_AUTO_COORD_ENABLED )
+ if ( auto_coordination->getBoolValue() )
{
set_rudder( aileron / 2.0 );
}
CLAMP( &aileron, -1.0, 1.0 );
// check for autocoordination
- if ( current_options.get_auto_coordination() ==
- fgOPTIONS::FG_AUTO_COORD_ENABLED )
+ if ( auto_coordination->getBoolValue() )
{
set_rudder( aileron / 2.0 );
}
CLAMP( &rudder, -1.0, 1.0 );
}
inline void set_flaps( double pos ) {
+ if ( flaps != pos ) {
+ globals->get_soundmgr()->play_once( "flaps" );
+ }
flaps = pos;
CLAMP( &flaps, 0.0, 1.0 );
}
inline void move_flaps( double amt ) {
+ if ( fabs(amt) > 0.0 ) {
+ globals->get_soundmgr()->play_once( "flaps" );
+ }
flaps += amt;
CLAMP( &flaps, 0.0, 1.0 );
}