Basically what I've done here is expanded upon the ejection seat
properties to make them more flexible.
I did this as a patch because it was something that a) needed to be done
and b) looked simple enough for me to do without botching it too badly. :)
The former property node was:
/controls/seat/eject as a boolean value.
Since there are a number of ejection seat equipped aircraft out there that
have more than one seat, I've added code to track those.
The tree now looks like this:
/controls/seat/eject[%d]/initiate - bool
If this becomes true, then the handles were pulled.
/controls/seat/eject[%d]/status - int
This describes the current status of each seat.
SEAT_SAFED - seat won't fire if handles are pulled (no code behind this
yet)
SEAT_ARMED - the safety pins have been removed and the seat CAN be fired.
SEAT_FAIL - initiator train has failed or instructor forced the seat not
to operate.
/controls/seat/cmd_selector_valve - int
This holds the position of the Command Selector Valve that is used
to control how 2 seat ejection functions.
CMD_SEL_NORM - Rear seat fires and then front seat fires if front seat
fires. If the rear seat is fired, it does not initiate the front seat.
CMD_SEL_AFT - Rear seat fires first when triggered from either seat.
CMD_SEL_SOLO - Front seat fires and then rear seat after a small delay.
There's more technically descriptive detail about how the whole system is
supposed to work, but for a basic first pass this should suffice.
Note that the only real functionality is in the handling of the seat
status condition when a seat is "fired". No other programming has been
done as yet. However, if someone adds a bang seat to one of the models,
I'd be happy to get the routines fleshed out more.
Questions? Comments? What'd I forget?
Thanks.
g.
Index: README.properties
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/docs-mini/README.properties,v
retrieving revision 1.2
diff -c -3 -p -r1.2 README.properties
*** README.properties 1 Apr 2003 18:58:46 -0000 1.2
--- README.properties 11 Nov 2003 23:41:30 -0000
*************** Seat
*** 119,125 ****
----
/controls/seat/vertical-adjust
/controls/seat/fore-aft-adjust
! /controls/seat/eject
APU
---
--- 119,127 ----
----
/controls/seat/vertical-adjust
/controls/seat/fore-aft-adjust
! /controls/seat/cmd_selector_valve
! /controls/seat/eject[%d]/initiate
! /controls/seat/eject[%d]/status
APU
---
Index: controls.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Controls/controls.hxx,v
retrieving revision 1.6
diff -c -3 -p -r1.6 controls.hxx
*** controls.hxx 24 Sep 2003 17:20:56 -0000 1.6
--- controls.hxx 11 Nov 2003 23:36:19 -0000
*************** public:
*** 86,91 ****
--- 86,108 ----
MAX_AUTOPILOTS = 3
};
+ enum {
+ ALL_EJECTION_SEATS = -1,
+ MAX_EJECTION_SEATS = 10
+ };
+
+ enum {
+ SEAT_SAFED = -1,
+ SEAT_ARMED = 0,
+ SEAT_FAIL = 1
+ };
+
+ enum {
+ CMD_SEL_NORM = -1,
+ CMD_SEL_AFT = 0,
+ CMD_SEL_SOLO = 1
+ };
+
private:
// controls/flight/
double aileron;
*************** private:
*** 211,219 ****
// controls/seat/
double vertical_adjust;
double fore_aft_adjust;
! bool eject;
!
! // controls/APU/
int off_start_run;
bool APU_fire_switch;
--- 228,238 ----
// controls/seat/
double vertical_adjust;
double fore_aft_adjust;
! bool eject[MAX_EJECTION_SEATS];
! int status[MAX_EJECTION_SEATS];
! int cmd_selector_valve;
!
! // controls/APU/
int off_start_run;
bool APU_fire_switch;
*************** public:
*** 394,400 ****
// controls/seat/
inline double get_vertical_adjust() const { return vertical_adjust; }
inline double get_fore_aft_adjust() const { return fore_aft_adjust; }
! inline bool get_eject() const { return eject; }
// controls/APU/
inline int get_off_start_run() const { return off_start_run; }
--- 413,422 ----
// controls/seat/
inline double get_vertical_adjust() const { return vertical_adjust; }
inline double get_fore_aft_adjust() const { return fore_aft_adjust; }
! inline bool get_ejection_seat(int which_seat) const { return eject[which_seat]; }
! inline int get_eseat_status(int which_seat) const { return status[which_seat]; }
! inline int get_cmd_selector_valve() const { return cmd_selector_valve; }
!
// controls/APU/
inline int get_off_start_run() const { return off_start_run; }
*************** public:
*** 571,577 ****
void move_vertical_adjust( double amt );
void set_fore_aft_adjust( double pos );
void move_fore_aft_adjust( double amt );
! void set_eject( bool val );
// controls/APU/
void set_off_start_run( int pos );
--- 593,601 ----
void move_vertical_adjust( double amt );
void set_fore_aft_adjust( double pos );
void move_fore_aft_adjust( double amt );
! void set_ejection_seat( int which_seat, bool val );
! void set_eseat_status( int which_seat, int val );
! void set_cmd_selector_valve( int val );
// controls/APU/
void set_off_start_run( int pos );
Index: controls.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Controls/controls.cxx,v
retrieving revision 1.8
diff -c -3 -p -r1.8 controls.cxx
*** controls.cxx 13 May 2003 11:35:35 -0000 1.8
--- controls.cxx 12 Nov 2003 01:12:19 -0000
*************** FGControls::FGControls() :
*** 102,108 ****
release_ALL( false ),
vertical_adjust( 0.0 ),
fore_aft_adjust( 0.0 ),
- eject( false ),
off_start_run( 0 ),
APU_fire_switch( false ),
autothrottle_arm( false ),
--- 102,107 ----
*************** void FGControls::reset_all()
*** 166,172 ****
landing_lights = false;
turn_off_lights = false;
master_arm = false;
! eject = false;
APU_fire_switch = false;
autothrottle_arm = false;
autothrottle_engage = false;
--- 165,173 ----
landing_lights = false;
turn_off_lights = false;
master_arm = false;
! set_ejection_seat( ALL_EJECTION_SEATS, false );
! set_eseat_status( ALL_EJECTION_SEATS, SEAT_SAFED );
! set_cmd_selector_valve( CMD_SEL_NORM );
APU_fire_switch = false;
autothrottle_arm = false;
autothrottle_engage = false;
*************** FGControls::bind ()
*** 681,689 ****
&FGControls::set_fore_aft_adjust);
fgSetArchivable("/controls/seat/fore-aft-adjust");
! fgTie("/controls/seat/eject", this,
! &FGControls::get_eject, &FGControls::set_eject);
! fgSetArchivable("/controls/seat/eject");
// APU
fgTie("/controls/APU/off-start-run", this,
--- 682,711 ----
&FGControls::set_fore_aft_adjust);
fgSetArchivable("/controls/seat/fore-aft-adjust");
! for (index = 0; index < MAX_EJECTION_SEATS; index++) {
! char name[MAX_NAME_LEN];
! snprintf(name, MAX_NAME_LEN,
! "/controls/seat/eject[%d]/initiate", index);
! fgTie(name, this, index,
! &FGControls::get_ejection_seat,
! &FGControls::set_ejection_seat);
! fgSetArchivable(name);
!
! snprintf(name, MAX_NAME_LEN,
! "/controls/seat/eject[%d]/status", index);
!
! fgTie(name, this, index,
! &FGControls::get_eseat_status,
! &FGControls::set_eseat_status);
!
! fgSetArchivable(name);
! }
!
! fgTie("/controls/seat/cmd_selector_valve", this,
! &FGControls::get_cmd_selector_valve,
! &FGControls::set_cmd_selector_valve);
! fgSetArchivable("/controls/seat/eject/cmd_selector_valve");
!
// APU
fgTie("/controls/APU/off-start-run", this,
*************** void FGControls::unbind ()
*** 942,948 ****
#endif
fgUntie("/controls/seat/vertical-adjust");
fgUntie("/controls/seat/fore-aft-adjust");
! fgUntie("/controls/seat/eject");
fgUntie("/controls/APU/off-start-run");
fgUntie("/controls/APU/fire-switch");
for (index = 0; index < MAX_AUTOPILOTS; index++) {
--- 964,980 ----
#endif
fgUntie("/controls/seat/vertical-adjust");
fgUntie("/controls/seat/fore-aft-adjust");
! for (index = 0; index < MAX_EJECTION_SEATS; index++) {
! char name[MAX_NAME_LEN];
! snprintf(name, MAX_NAME_LEN,
! "/controls/seat/eject[%d]/initiate", index);
! fgUntie(name);
! snprintf(name, MAX_NAME_LEN,
! "/controls/seat/eject[%d]/status", index);
! fgUntie(name);
! }
! fgUntie("/controls/seat/cmd_selector_valve");
!
fgUntie("/controls/APU/off-start-run");
fgUntie("/controls/APU/fire-switch");
for (index = 0; index < MAX_AUTOPILOTS; index++) {
*************** FGControls::move_fore_aft_adjust( double
*** 2033,2043 ****
}
void
! FGControls::set_eject( bool val )
{
! eject = val;
}
void
FGControls::set_off_start_run( int pos )
{
--- 2065,2116 ----
}
void
! FGControls::set_ejection_seat( int which_seat, bool val )
! {
! if ( which_seat == ALL_EJECTION_SEATS ) {
! for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
! eject[i] = val;
! }
! } else {
! if ( (which_seat >=0) && (which_seat <= MAX_EJECTION_SEATS) ) {
! if (val == true) {
! switch (status[which_seat]) {
! SEAT_SAFED:
! SEAT_FAIL : eject[which_seat] = false;
! break;
! SEAT_ARMED: eject[which_seat] = true;
! break;
! default:
! // we are _so_ in trouble by now...
! eject[which_seat] = false;
! }
! }
! eject[which_seat] = val;
! }
! }
! }
!
! void
! FGControls::set_eseat_status( int which_seat, int val )
! {
! if ( which_seat == ALL_EJECTION_SEATS ) {
! for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
! status[i] = val;
! }
! } else {
! if ( (which_seat >=0) && (which_seat <= MAX_EJECTION_SEATS) ) {
! status[which_seat] = val;
! }
! }
! }
!
! void
! FGControls::set_cmd_selector_valve( int val )
{
! cmd_selector_valve = val;
}
+
void
FGControls::set_off_start_run( int pos )
{
_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel