1
0
Fork 0

Add support for "co-pilot" toe brakes.

This commit is contained in:
curt 2004-09-10 17:53:34 +00:00
parent f42e3cb2ac
commit 3a7cef79c8
4 changed files with 50 additions and 2 deletions

View file

@ -74,6 +74,8 @@ FGControls::FGControls() :
dump_valve( false ),
brake_left( 0.0 ),
brake_right( 0.0 ),
copilot_brake_left( 0.0 ),
copilot_brake_right( 0.0 ),
brake_parking( 0.0 ),
steering( 0.0 ),
gear_down( true ),
@ -204,7 +206,9 @@ FGControls::init ()
condition[engine] = 1.0;
}
brake_left = brake_right = brake_parking = 0.0;
brake_left = brake_right
= copilot_brake_left = copilot_brake_right
= brake_parking = 0.0;
for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
alternate_extension[wheel] = false;
}
@ -433,6 +437,16 @@ FGControls::bind ()
&FGControls::set_brake_right);
fgSetArchivable("/controls/gear/brake-right");
fgTie("/controls/gear/copilot-brake-left", this,
&FGControls::get_copilot_brake_left,
&FGControls::set_copilot_brake_left);
fgSetArchivable("/controls/gear/copilot-brake-left");
fgTie("/controls/gear/copilot-brake-right", this,
&FGControls::get_copilot_brake_right,
&FGControls::set_copilot_brake_right);
fgSetArchivable("/controls/gear/copilot-brake-right");
fgTie("/controls/gear/brake-parking", this,
&FGControls::get_brake_parking,
&FGControls::set_brake_parking);
@ -1628,6 +1642,20 @@ FGControls::move_brake_right( double amt )
CLAMP( &brake_right, 0.0, 1.0 );
}
void
FGControls::set_copilot_brake_left( double pos )
{
copilot_brake_left = pos;
CLAMP(&brake_left, 0.0, 1.0);
}
void
FGControls::set_copilot_brake_right( double pos )
{
copilot_brake_right = pos;
CLAMP(&brake_right, 0.0, 1.0);
}
void
FGControls::set_brake_parking( double pos )
{

View file

@ -156,6 +156,8 @@ private:
// controls/gear/
double brake_left;
double brake_right;
double copilot_brake_left;
double copilot_brake_right;
double brake_parking;
double steering;
bool gear_down;
@ -336,6 +338,8 @@ public:
// controls/gear/
inline double get_brake_left() const { return brake_left; }
inline double get_brake_right() const { return brake_right; }
inline double get_copilot_brake_left() const { return copilot_brake_left; }
inline double get_copilot_brake_right() const { return copilot_brake_right; }
inline double get_brake_parking() const { return brake_parking; }
inline double get_steering() const { return steering; }
inline bool get_gear_down() const { return gear_down; }
@ -519,6 +523,8 @@ public:
void move_brake_left( double amt );
void set_brake_right( double pos );
void move_brake_right( double amt );
void set_copilot_brake_left( double pos );
void set_copilot_brake_right( double pos );
void set_brake_parking( double pos );
void set_steering( double pos );
void move_steering( double amt );

View file

@ -187,6 +187,10 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
node = fgGetNode("/controls/gear", true);
net->brake_left = node->getChild("brake-left")->getDoubleValue();
net->brake_right = node->getChild("brake-right")->getDoubleValue();
net->copilot_brake_left
= node->getChild("copilot-brake-left")->getDoubleValue();
net->copilot_brake_right
= node->getChild("copilot-brake-right")->getDoubleValue();
net->brake_parking = node->getChild("brake-parking")->getDoubleValue();
net->gear_handle = fgGetBool( "controls/gear/gear-down" );
@ -262,6 +266,8 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
net->num_tanks = htonl(net->num_tanks);
htond(net->brake_left);
htond(net->brake_right);
htond(net->copilot_brake_left);
htond(net->copilot_brake_right);
htond(net->brake_parking);
net->gear_handle = htonl(net->gear_handle);
net->master_avionics = htonl(net->master_avionics);
@ -321,6 +327,8 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
}
htond(net->brake_left);
htond(net->brake_right);
htond(net->copilot_brake_left);
htond(net->copilot_brake_right);
htond(net->brake_parking);
net->gear_handle = htonl(net->gear_handle);
net->master_avionics = htonl(net->master_avionics);
@ -390,6 +398,10 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
if ( node != NULL ) {
node->getChild( "brake-left" )->setDoubleValue( net->brake_left );
node->getChild( "brake-right" )->setDoubleValue( net->brake_right );
node->getChild( "copilot-brake-left" )
->setDoubleValue( net->copilot_brake_left );
node->getChild( "copilot-brake-right" )
->setDoubleValue( net->copilot_brake_right );
node->getChild( "brake-parking" )->setDoubleValue( net->brake_parking );
}

View file

@ -16,7 +16,7 @@
# error This library requires C++
#endif
const int FG_NET_CTRLS_VERSION = 22;
const int FG_NET_CTRLS_VERSION = 23;
// Define a structure containing the control parameters
@ -71,6 +71,8 @@ public:
// Brake controls
double brake_left;
double brake_right;
double copilot_brake_left;
double copilot_brake_right;
double brake_parking;
// Landing Gear