Added a simple auto-coordination capability.
This commit is contained in:
parent
038b68153e
commit
6de1139450
2 changed files with 16 additions and 1 deletions
src/Controls
|
@ -2,4 +2,4 @@ noinst_LIBRARIES = libControls.a
|
||||||
|
|
||||||
libControls_a_SOURCES = controls.cxx controls.hxx
|
libControls_a_SOURCES = controls.cxx controls.hxx
|
||||||
|
|
||||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Simulator
|
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#ifndef _CONTROLS_HXX
|
#ifndef _CONTROLS_HXX
|
||||||
#define _CONTROLS_HXX
|
#define _CONTROLS_HXX
|
||||||
|
|
||||||
|
#include <Main/options.hxx>
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
# error This library requires C++
|
# error This library requires C++
|
||||||
|
@ -78,11 +79,25 @@ public:
|
||||||
aileron = pos;
|
aileron = pos;
|
||||||
if ( aileron < -1.0 ) aileron = -1.0;
|
if ( aileron < -1.0 ) aileron = -1.0;
|
||||||
if ( aileron > 1.0 ) aileron = 1.0;
|
if ( aileron > 1.0 ) aileron = 1.0;
|
||||||
|
|
||||||
|
// check for autocoordination
|
||||||
|
if ( current_options.get_auto_coordination() ==
|
||||||
|
fgOPTIONS::FG_AUTO_COORD_ENABLED )
|
||||||
|
{
|
||||||
|
set_rudder( aileron / 2.0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
inline void move_aileron( double amt ) {
|
inline void move_aileron( double amt ) {
|
||||||
aileron += amt;
|
aileron += amt;
|
||||||
if ( aileron < -1.0 ) aileron = -1.0;
|
if ( aileron < -1.0 ) aileron = -1.0;
|
||||||
if ( aileron > 1.0 ) aileron = 1.0;
|
if ( aileron > 1.0 ) aileron = 1.0;
|
||||||
|
|
||||||
|
// check for autocoordination
|
||||||
|
if ( current_options.get_auto_coordination() ==
|
||||||
|
fgOPTIONS::FG_AUTO_COORD_ENABLED )
|
||||||
|
{
|
||||||
|
set_rudder( aileron / 2.0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
inline void set_elevator( double pos ) {
|
inline void set_elevator( double pos ) {
|
||||||
elevator = pos;
|
elevator = pos;
|
||||||
|
|
Loading…
Add table
Reference in a new issue