1
0
Fork 0

Added a fuel selector switch. I understand that this won't handle all

situations for every kind of airplane.  But at the moment we have nothing
implimented and this will cover the simpler cases until someone has a
chance to impliment a fuller solution.
This commit is contained in:
curt 2002-07-05 14:46:38 +00:00
parent 1c91723cef
commit 6d3204eedd
2 changed files with 27 additions and 13 deletions

View file

@ -62,6 +62,7 @@ FGControls::FGControls() :
flaps( 0.0 ), flaps( 0.0 ),
parking_brake( 0.0 ), parking_brake( 0.0 ),
throttle_idle( true ), throttle_idle( true ),
fuel_selector( FUEL_BOTH ),
gear_down( false ) gear_down( false )
{ {
} }
@ -75,10 +76,11 @@ void FGControls::reset_all()
set_elevator_trim( 0.0 ); set_elevator_trim( 0.0 );
set_rudder( 0.0 ); set_rudder( 0.0 );
set_rudder_trim( 0.0 ); set_rudder_trim( 0.0 );
set_throttle(FGControls::ALL_ENGINES, 0.0); set_throttle( ALL_ENGINES, 0.0 );
set_starter(FGControls::ALL_ENGINES, false); set_starter( ALL_ENGINES, false );
set_magnetos(FGControls::ALL_ENGINES, 0); set_magnetos( ALL_ENGINES, 0 );
throttle_idle = true; throttle_idle = true;
fuel_selector = FUEL_BOTH;
gear_down = true; gear_down = true;
} }
@ -165,6 +167,9 @@ FGControls::bind ()
&FGControls::get_brake, &FGControls::set_brake); &FGControls::get_brake, &FGControls::set_brake);
fgSetArchivable(name); fgSetArchivable(name);
} }
fgTie("/controls/fuel-selector", this,
&FGControls::get_fuel_selector, &FGControls::set_fuel_selector);
fgSetArchivable("/controls/gear-down");
fgTie("/controls/gear-down", this, fgTie("/controls/gear-down", this,
&FGControls::get_gear_down, &FGControls::set_gear_down); &FGControls::get_gear_down, &FGControls::set_gear_down);
fgSetArchivable("/controls/gear-down"); fgSetArchivable("/controls/gear-down");
@ -201,6 +206,7 @@ FGControls::unbind ()
sprintf(name, "/controls/brakes[%d]", index); sprintf(name, "/controls/brakes[%d]", index);
fgUntie(name); fgUntie(name);
} }
fgUntie("/controls/fuel-selector");
fgUntie("/controls/gear-down"); fgUntie("/controls/gear-down");
} }

View file

@ -41,18 +41,23 @@ class FGControls : public FGSubsystem
public: public:
enum enum {
{
ALL_ENGINES = -1, ALL_ENGINES = -1,
MAX_ENGINES = 10 MAX_ENGINES = 10
}; };
enum enum {
{
ALL_WHEELS = -1, ALL_WHEELS = -1,
MAX_WHEELS = 3 MAX_WHEELS = 3
}; };
enum {
FUEL_OFF = 0,
FUEL_LEFT = 1,
FUEL_RIGHT = 2,
FUEL_BOTH = 3
};
private: private:
double aileron; double aileron;
@ -70,6 +75,7 @@ private:
int magnetos[MAX_ENGINES]; int magnetos[MAX_ENGINES];
bool throttle_idle; bool throttle_idle;
bool starter[MAX_ENGINES]; bool starter[MAX_ENGINES];
int fuel_selector;
bool gear_down; bool gear_down;
SGPropertyNode * auto_coordination; SGPropertyNode * auto_coordination;
@ -105,6 +111,7 @@ public:
inline double get_brake(int wheel) const { return brake[wheel]; } inline double get_brake(int wheel) const { return brake[wheel]; }
inline int get_magnetos(int engine) const { return magnetos[engine]; } inline int get_magnetos(int engine) const { return magnetos[engine]; }
inline bool get_starter(int engine) const { return starter[engine]; } inline bool get_starter(int engine) const { return starter[engine]; }
inline int get_fuel_selector() const { return fuel_selector; }
inline bool get_gear_down() const { return gear_down; } inline bool get_gear_down() const { return gear_down; }
// Update functions // Update functions
@ -131,6 +138,7 @@ public:
void set_magnetos( int engine, int pos ); void set_magnetos( int engine, int pos );
void move_magnetos( int engine, int amt ); void move_magnetos( int engine, int amt );
void set_starter( int engine, bool flag ); void set_starter( int engine, bool flag );
void set_fuel_selector( int pos ) { fuel_selector = pos; }
void set_parking_brake( double pos ); void set_parking_brake( double pos );
void set_brake( int wheel, double pos ); void set_brake( int wheel, double pos );
void move_brake( int wheel, double amt ); void move_brake( int wheel, double amt );