Merge branch 'next' of http://git.gitorious.org/fg/flightgear into next
This commit is contained in:
commit
1d887677b9
18 changed files with 1543 additions and 66 deletions
|
@ -72,9 +72,9 @@ endif()
|
|||
if(EVENT_INPUT)
|
||||
message(STATUS "checking event-based Input")
|
||||
IF(APPLE)
|
||||
|
||||
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
|
||||
|
||||
else()
|
||||
message(WARNING "event input is not supported on this platform yet")
|
||||
endif()
|
||||
|
@ -163,6 +163,11 @@ endif(HAVE_RT)
|
|||
endif(NOT CLOCK_GETTIME_IN_LIBC)
|
||||
endif(HAVE_CLOCK_GETTIME)
|
||||
|
||||
find_package(RTI)
|
||||
if(RTI_FOUND)
|
||||
set(FG_HAVE_HLA 1)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(WARNING_FLAGS -Wall)
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
@ -185,9 +190,9 @@ endif(WIN32)
|
|||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} -D_REENTRANT")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} -D_REENTRANT")
|
||||
|
||||
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${ALUT_INCLUDE_DIR}
|
||||
${OPENAL_INCLUDE_DIR}
|
||||
${SIMGEAR_INCLUDE_DIR}
|
||||
|
|
55
configure.ac
55
configure.ac
|
@ -29,15 +29,15 @@ else
|
|||
fi
|
||||
|
||||
AC_CHECK_PROG([HAVE_GIT], git, 1)
|
||||
if test "x$HAVE_GIT" != "x" ; then
|
||||
if test "x$HAVE_GIT" != "x" ; then
|
||||
# git might be installed, but we might be building from a tarball
|
||||
if git rev-parse ; then
|
||||
AC_SUBST([REVISION], `git rev-parse HEAD`)
|
||||
else
|
||||
AC_SUBST([REVISION], [none])
|
||||
AC_SUBST([REVISION], [none])
|
||||
fi
|
||||
else
|
||||
AC_SUBST([REVISION], [none])
|
||||
AC_SUBST([REVISION], [none])
|
||||
fi
|
||||
|
||||
dnl Checks for programs.
|
||||
|
@ -90,7 +90,7 @@ case "${host}" in
|
|||
|
||||
dnl Thank you Christian Bauer from SheepSaver
|
||||
dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
|
||||
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH, $4=ACTION_IF_FOUND) ;
|
||||
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH, $4=ACTION_IF_FOUND) ;
|
||||
AC_DEFUN([AC_CHECK_FRAMEWORK], [
|
||||
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
|
||||
AC_CACHE_CHECK([whether compiler supports framework $1],
|
||||
|
@ -251,13 +251,55 @@ if test "x$with_threads" = "xyes"; then
|
|||
fi
|
||||
AC_CHECK_HEADER(pthread.h)
|
||||
|
||||
dnl Configure HLA support
|
||||
AC_ARG_WITH(rti13, [ --with-rti13[[=PATH]] Enable the HLA/RTI 1.3 interface, set a path to the RTI13 RTI libraries (default=no)])
|
||||
if test "x$with_rti13" != "xno"; then
|
||||
if test "x$with_rti13" != "xyes"; then
|
||||
AC_SUBST(HLA_CPPFLAGS, "-I$with_rti13/include")
|
||||
AC_SUBST(HLA_LDFLAGS, "-L$with_rti13/lib")
|
||||
fi
|
||||
|
||||
dnl Configure HLA support
|
||||
AC_MSG_CHECKING([for simgear HLA/RTI support])
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_TRY_COMPILE([
|
||||
#include <simgear/hla/HLA13Federate.hxx>
|
||||
],[
|
||||
new simgear::HLA13Federate;
|
||||
], simgear_hla=yes, simgear_hla=no)
|
||||
AC_MSG_RESULT($simgear_hla)
|
||||
if test "x$simgear_hla" = "xyes" ; then
|
||||
AC_MSG_CHECKING([for hla libraries])
|
||||
saved_LIBS="$LIBS"
|
||||
for rti13libs in "-lRTI-NG -lFedTime" "-lRTI-NGd -lFedTimed" ; do
|
||||
if test "x$hla_libs" = "x" ; then
|
||||
LIBS="-lsghla13 -lsghla -lsgxml -lsgstructure -lsgmath -lsgdebug -lsgtiming $rti13libs -lrt $saved_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <simgear/hla/HLA13Federate.hxx>
|
||||
],[
|
||||
new simgear::HLA13Federate;
|
||||
], [hla_libs="$rti13libs"; have_rti13=yes],)
|
||||
fi
|
||||
done
|
||||
LIBS="$saved_LIBS"
|
||||
AC_MSG_RESULT($hla_libs)
|
||||
fi
|
||||
AC_LANG_POP()
|
||||
fi
|
||||
dnl Currently only the rti13 variant, but in the future also rti1516
|
||||
AM_CONDITIONAL(WITH_HLA, test "x$have_rti13" = "xyes")
|
||||
if test "x$have_rti13" = "xyes" ; then
|
||||
AC_DEFINE([FG_HAVE_HLA], 1, [Define if HLA/RTI is available.])
|
||||
AC_SUBST(HLA_LIBS, "-lsghla13 -lsghla $hla_libs")
|
||||
fi
|
||||
|
||||
dnl Used by JSBSim to conditionally compile in fgfs interface code
|
||||
AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
|
||||
|
||||
# Check for MS Windows environment
|
||||
AC_CHECK_HEADER(windows.h)
|
||||
|
||||
dnl Using AM_CONDITIONAL is a step out of the protected little
|
||||
dnl Using AM_CONDITIONAL is a step out of the protected little
|
||||
dnl automake fold so it is potentially dangerous. But, we are
|
||||
dnl beginning to run into cases where the standard checks are not
|
||||
dnl enough. AM_CONDITIONALS are then referenced to conditionally
|
||||
|
@ -453,7 +495,7 @@ case "${host}" in
|
|||
# Mac OS X has OpenAL.framework, but no ALUT, by default, so we
|
||||
# require use of a non-Apple ALUT.framework which we provide
|
||||
openal_LIBS="-framework IOKit -framework OpenAL"
|
||||
|
||||
|
||||
AC_CHECK_FRAMEWORK(OpenAL, [#include <OpenAL/al.h>], "", [OPENAL_OK="yes"])
|
||||
AC_CHECK_FRAMEWORK(ALUT, [#include <ALUT/alut.h>], $with_alut_framework, [
|
||||
ALUT_OK="yes"
|
||||
|
@ -878,6 +920,7 @@ AC_CONFIG_FILES([ \
|
|||
src/MultiPlayer/Makefile \
|
||||
src/Navaids/Makefile \
|
||||
src/Network/Makefile \
|
||||
src/Network/HLA/Makefile \
|
||||
src/Scenery/Makefile \
|
||||
src/Scripting/Makefile \
|
||||
src/Sound/Makefile \
|
||||
|
|
|
@ -2,10 +2,10 @@ Use FlightGear.sln to compile fgfs executable for Win32 or x64 architectures wit
|
|||
Previous versions of Visual Studio are not officially supported anymore.
|
||||
|
||||
Precompiled librairies and headers for compiling x64 executables with VS2008 :
|
||||
ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-x64-VS90-3rdParty+OSG-20101106.zip
|
||||
ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-x64-VS90-3rdParty+OSG-20110117.zip
|
||||
|
||||
Precompiled librairies and headers for compiling Win32 executables with VS2008 :
|
||||
ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-win32-VS90-3rdParty+OSG-20101106.zip
|
||||
ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-win32-VS90-3rdParty+OSG-20110117.zip
|
||||
|
||||
The VS2008 / v9.0 project files assume the directory layout below :
|
||||
|
||||
|
|
|
@ -59,6 +59,9 @@ public:
|
|||
void addPropertyId(unsigned id, const char* name)
|
||||
{ mPropertyMap[id] = props->getNode(name, true); }
|
||||
|
||||
SGPropertyNode* getPropertyRoot()
|
||||
{ return props; }
|
||||
|
||||
virtual const char* getTypeString(void) const { return "multiplayer"; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -36,23 +36,7 @@ PeriodicalValue::PeriodicalValue( SGPropertyNode_ptr root )
|
|||
|
||||
double PeriodicalValue::normalize( double value )
|
||||
{
|
||||
if( !(minPeriod && maxPeriod )) return value;
|
||||
|
||||
double p1 = minPeriod->get_value();
|
||||
double p2 = maxPeriod->get_value();
|
||||
|
||||
double min = std::min<double>(p1,p2);
|
||||
double max = std::max<double>(p1,p2);
|
||||
double phase = fabs(max - min);
|
||||
|
||||
if( phase > SGLimitsd::min() ) {
|
||||
while( value < min ) value += phase;
|
||||
while( value >= max ) value -= phase;
|
||||
} else {
|
||||
value = min; // phase is zero
|
||||
}
|
||||
|
||||
return value;
|
||||
return SGMiscd::normalizePeriodic( minPeriod->get_value(), maxPeriod->get_value(), value );
|
||||
}
|
||||
|
||||
InputValue::InputValue( SGPropertyNode_ptr node, double value, double offset, double scale) :
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
#cmakedefine ENABLE_SP_FDM
|
||||
|
||||
// JSBSim needs this, to switch from standalone to in-FG mode
|
||||
#define FGFS
|
||||
#define FGFS
|
||||
|
||||
#define PU_USE_NONE // PLIB needs this to avoid linking to GLUT
|
||||
|
||||
#cmakedefine ENABLE_PLIB_JOYSTICK
|
||||
|
||||
// threads are required (used to be optional)
|
||||
#define ENABLE_THREADS 1
|
||||
#define ENABLE_THREADS 1
|
||||
|
||||
// audio support is assumed
|
||||
#define ENABLE_AUDIO_SUPPORT 1
|
||||
#define ENABLE_AUDIO_SUPPORT 1
|
||||
|
||||
#cmakedefine HAVE_SYS_TIME_H
|
||||
#cmakedefine HAVE_WINDOWS_H
|
||||
|
@ -33,3 +33,5 @@
|
|||
#cmakedefine HAVE_LIBSVN_CLIENT_1
|
||||
|
||||
#define PKGLIBDIR "@PKGLIBDIR"
|
||||
|
||||
#cmakedefine FG_HAVE_HLA
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
|
@ -33,6 +31,12 @@
|
|||
#include <fcntl.h>
|
||||
#include "FGLinuxEventInput.hxx"
|
||||
|
||||
#include <poll.h>
|
||||
#include <linux/input.h>
|
||||
#include <dbus/dbus.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
struct TypeCode {
|
||||
unsigned type;
|
||||
|
@ -277,9 +281,9 @@ FGLinuxInputDevice::FGLinuxInputDevice() :
|
|||
{
|
||||
}
|
||||
|
||||
static inline bool bitSet( unsigned char * buf, unsigned char bit )
|
||||
static inline bool bitSet( unsigned char * buf, unsigned bit )
|
||||
{
|
||||
return (buf[bit/sizeof(bit)/8] >> (bit%(sizeof(bit)*8))) & 1;
|
||||
return (buf[bit/sizeof(unsigned char)/8] >> (bit%(sizeof(unsigned char)*8))) & 1;
|
||||
}
|
||||
|
||||
void FGLinuxInputDevice::Open()
|
||||
|
@ -293,19 +297,75 @@ void FGLinuxInputDevice::Open()
|
|||
SG_LOG( SG_INPUT, SG_WARN, "Can't grab " << devname << " for exclusive access" );
|
||||
}
|
||||
|
||||
unsigned char buf[ABS_CNT/sizeof(unsigned char)/8];
|
||||
// get axes maximums
|
||||
if( ioctl( fd, EVIOCGBIT(EV_ABS,ABS_MAX), buf ) == -1 ) {
|
||||
SG_LOG( SG_INPUT, SG_WARN, "Can't get abs-axes for " << devname );
|
||||
} else {
|
||||
for( unsigned i = 0; i < ABS_MAX; i++ ) {
|
||||
if( bitSet( buf, i ) ) {
|
||||
struct input_absinfo ai;
|
||||
if( ioctl(fd, EVIOCGABS(i), &ai) == -1 ) {
|
||||
SG_LOG( SG_INPUT, SG_WARN, "Can't get abs-axes maximums for " << devname );
|
||||
continue;
|
||||
{
|
||||
unsigned char buf[ABS_CNT/sizeof(unsigned char)/8];
|
||||
// get axes maximums
|
||||
if( ioctl( fd, EVIOCGBIT(EV_ABS,ABS_MAX), buf ) == -1 ) {
|
||||
SG_LOG( SG_INPUT, SG_WARN, "Can't get abs-axes for " << devname );
|
||||
} else {
|
||||
for( unsigned i = 0; i < ABS_MAX; i++ ) {
|
||||
if( bitSet( buf, i ) ) {
|
||||
struct input_absinfo ai;
|
||||
if( ioctl(fd, EVIOCGABS(i), &ai) == -1 ) {
|
||||
SG_LOG( SG_INPUT, SG_WARN, "Can't get abs-axes maximums for " << devname );
|
||||
continue;
|
||||
}
|
||||
absinfo[i] = ai;
|
||||
SG_LOG( SG_INPUT, SG_INFO, "Axis #" << i <<
|
||||
": value=" << ai.value <<
|
||||
": minimum=" << ai.minimum <<
|
||||
": maximum=" << ai.maximum <<
|
||||
": fuzz=" << ai.fuzz <<
|
||||
": flat=" << ai.flat <<
|
||||
": resolution=" << ai.resolution );
|
||||
|
||||
// kick an initial event
|
||||
struct input_event event;
|
||||
event.type = EV_ABS;
|
||||
event.code = i;
|
||||
event.value = ai.value;
|
||||
FGLinuxEventData eventData( event, 0, 0 );
|
||||
eventData.value = Normalize( event );
|
||||
HandleEvent(eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned char mask[KEY_CNT/sizeof(unsigned char)/8];
|
||||
unsigned char flag[KEY_CNT/sizeof(unsigned char)/8];
|
||||
memset(mask,0,sizeof(mask));
|
||||
memset(flag,0,sizeof(flag));
|
||||
if( ioctl( fd, EVIOCGKEY(sizeof(flag)), flag ) == -1 ||
|
||||
ioctl( fd, EVIOCGBIT(EV_KEY, sizeof(mask)), mask ) == -1 ) {
|
||||
SG_LOG( SG_INPUT, SG_WARN, "Can't get keys for " << devname );
|
||||
} else {
|
||||
for( unsigned i = 0; i < KEY_MAX; i++ ) {
|
||||
if( bitSet( mask, i ) ) {
|
||||
struct input_event event;
|
||||
event.type = EV_KEY;
|
||||
event.code = i;
|
||||
event.value = bitSet(flag,i);
|
||||
FGLinuxEventData eventData( event, 0, 0 );
|
||||
HandleEvent(eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned char buf[SW_CNT/sizeof(unsigned char)/8];
|
||||
if( ioctl( fd, EVIOCGSW(sizeof(buf)), buf ) == -1 ) {
|
||||
SG_LOG( SG_INPUT, SG_WARN, "Can't get switches for " << devname );
|
||||
} else {
|
||||
for( unsigned i = 0; i < SW_MAX; i++ ) {
|
||||
if( bitSet( buf, i ) ) {
|
||||
struct input_event event;
|
||||
event.type = EV_SW;
|
||||
event.code = i;
|
||||
event.value = 1;
|
||||
FGLinuxEventData eventData( event, 0, 0 );
|
||||
HandleEvent(eventData);
|
||||
}
|
||||
absinfo[i] = ai;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -514,3 +574,4 @@ void FGLinuxEventInput::update( double dt )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,9 @@ ADF::init ()
|
|||
_ident_audible_node = node->getChild("ident-audible", 0, true);
|
||||
_power_btn_node = node->getChild("power-btn", 0, true);
|
||||
|
||||
if (_power_btn_node->getType() == simgear::props::NONE)
|
||||
_power_btn_node->setBoolValue(true); // front end didn't implement a power button
|
||||
|
||||
SGSoundMgr *smgr = globals->get_soundmgr();
|
||||
_sgr = smgr->find("avionics", true);
|
||||
_sgr->tie_to_listener();
|
||||
|
|
|
@ -30,8 +30,17 @@ get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
|
|||
#message(STATUS "OSG libs ${OPENSCENEGRAPH_LIBRARIES}")
|
||||
#message(STATUS "SG libs ${SIMGEAR_LIBRARIES}")
|
||||
|
||||
if(RTI_FOUND)
|
||||
find_sg_component(hla13 SIMGEAR_LIBRARIES)
|
||||
find_sg_component(hla SIMGEAR_LIBRARIES)
|
||||
set(HLA_LIBRARIES ${RTI_LIBRARIES})
|
||||
else()
|
||||
set(HLA_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
target_link_libraries(fgfs
|
||||
${FG_LIBS}
|
||||
${HLA_LIBRARIES}
|
||||
${SIMGEAR_LIBRARIES}
|
||||
${OPENSCENEGRAPH_LIBRARIES}
|
||||
${OPENAL_LIBRARY}
|
||||
|
|
|
@ -6,7 +6,7 @@ MPLAYER_LIBS = $(top_builddir)/src/MultiPlayer/libMultiPlayer.a
|
|||
if ENABLE_SP_FDM
|
||||
SP_FDM_LIBS = $(top_builddir)/src/FDM/SP/libSPFDM.a
|
||||
else
|
||||
SP_FDM_LIBS =
|
||||
SP_FDM_LIBS =
|
||||
endif
|
||||
|
||||
if WITH_EVENTINPUT
|
||||
|
@ -26,6 +26,10 @@ if HAVE_FRAMEWORK_OSG
|
|||
fgfs_OSG_FW = $(osg_FRAMEWORKS) $(openthreads_FRAMEWORK)
|
||||
endif
|
||||
|
||||
if WITH_HLA
|
||||
HLA_LDADD=$(HLA_LDFLAGS) $(top_builddir)/src/Network/HLA/libFGHLA.a $(HLA_LIBS)
|
||||
endif
|
||||
|
||||
GFX_CODE = fg_os_osgviewer.cxx fg_os_common.cxx fg_os.hxx
|
||||
|
||||
JSBSIM_LIBS = \
|
||||
|
@ -105,6 +109,7 @@ fgfs_LDADD = \
|
|||
$(top_builddir)/src/Time/libTime.a \
|
||||
$(top_builddir)/src/Traffic/libTraffic.a \
|
||||
$(top_builddir)/src/Environment/libEnvironment.a \
|
||||
$(HLA_LDADD) \
|
||||
-lsgroute -lsgsky -lsgsound -lsgephem -lsgtgdb -lsgmodel -lsgbvh \
|
||||
-lsgmaterial -lsgutil -lsgtiming -lsgio -lsgscreen -lsgmath -lsgbucket \
|
||||
-lsgprops -lsgdebug -lsgmagvar -lsgmisc -lsgnasal -lsgxml -lsgsound \
|
||||
|
@ -128,4 +133,4 @@ metar_LDADD = \
|
|||
-lz $(base_LIBS)
|
||||
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(top_builddir)/src
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(top_builddir)/src $(HLA_CPPFLAGS)
|
||||
|
|
|
@ -65,6 +65,9 @@
|
|||
#include <Network/rul.hxx>
|
||||
#include <Network/generic.hxx>
|
||||
#include <Network/multiplay.hxx>
|
||||
#ifdef FG_HAVE_HLA
|
||||
#include <Network/HLA/hla.hxx>
|
||||
#endif
|
||||
|
||||
#include "globals.hxx"
|
||||
#include "fg_io.hxx"
|
||||
|
@ -213,6 +216,10 @@ FGIO::parse_port_config( const string& config )
|
|||
string host = tokens[3];
|
||||
string port = tokens[4];
|
||||
return new FGMultiplay(dir, atoi(rate.c_str()), host, atoi(port.c_str()));
|
||||
#ifdef FG_HAVE_HLA
|
||||
} else if ( protocol == "hla" ) {
|
||||
return new FGHLA(tokens);
|
||||
#endif
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -223,7 +230,7 @@ FGIO::parse_port_config( const string& config )
|
|||
delete io;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (tokens.size() < 3) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "Incompatible number of network arguments.");
|
||||
return NULL;
|
||||
|
@ -253,7 +260,7 @@ FGIO::parse_port_config( const string& config )
|
|||
string baud = tokens[5];
|
||||
SG_LOG( SG_IO, SG_INFO, " baud = " << baud );
|
||||
|
||||
|
||||
|
||||
SGSerial *ch = new SGSerial( device, baud );
|
||||
io->set_io_channel( ch );
|
||||
} else if ( medium == "file" ) {
|
||||
|
@ -262,7 +269,7 @@ FGIO::parse_port_config( const string& config )
|
|||
SG_LOG( SG_IO, SG_ALERT, "Incompatible number of arguments for file I/O.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
string file = tokens[4];
|
||||
SG_LOG( SG_IO, SG_INFO, " file name = " << file );
|
||||
int repeat = 1;
|
||||
|
|
|
@ -118,7 +118,7 @@ fgSetDefaults ()
|
|||
// Otherwise, default to Scenery being in $FG_ROOT/Scenery
|
||||
globals->set_fg_scenery("");
|
||||
}
|
||||
|
||||
|
||||
// Position (deliberately out of range)
|
||||
fgSetDouble("/position/longitude-deg", 9999.0);
|
||||
fgSetDouble("/position/latitude-deg", 9999.0);
|
||||
|
@ -220,7 +220,7 @@ fgSetDefaults ()
|
|||
// HUD options
|
||||
fgSetString("/sim/startup/units", "feet");
|
||||
fgSetString("/sim/hud/frame-stat-type", "tris");
|
||||
|
||||
|
||||
// Time options
|
||||
fgSetInt("/sim/startup/time-offset", 0);
|
||||
fgSetString("/sim/startup/time-offset-type", "system-offset");
|
||||
|
@ -355,7 +355,7 @@ parse_time(const string& time_in) {
|
|||
|
||||
|
||||
// parse a date string (yyyy:mm:dd:hh:mm:ss) into a time_t (seconds)
|
||||
static long int
|
||||
static long int
|
||||
parse_date( const string& date)
|
||||
{
|
||||
struct tm gmt;
|
||||
|
@ -493,7 +493,7 @@ parse_time_offset( const string& time_str) {
|
|||
}
|
||||
|
||||
|
||||
// Parse --fov=x.xx type option
|
||||
// Parse --fov=x.xx type option
|
||||
static double
|
||||
parse_fov( const string& arg ) {
|
||||
double fov = atof(arg);
|
||||
|
@ -520,7 +520,7 @@ parse_fov( const string& arg ) {
|
|||
// point values are ok.
|
||||
//
|
||||
// Serial example "--nmea=serial,dir,hz,device,baud" where
|
||||
//
|
||||
//
|
||||
// device = OS device name of serial line to be open()'ed
|
||||
// baud = {300, 1200, 2400, ..., 230400}
|
||||
//
|
||||
|
@ -900,7 +900,7 @@ fgSetupProxy( const char *arg )
|
|||
string::size_type pos;
|
||||
|
||||
host = port = auth = "";
|
||||
if ((pos = options.find("@")) != string::npos)
|
||||
if ((pos = options.find("@")) != string::npos)
|
||||
auth = options.substr(0, pos++);
|
||||
else
|
||||
pos = 0;
|
||||
|
@ -981,7 +981,7 @@ fgOptViewOffset( const char *arg )
|
|||
} else {
|
||||
default_view_offset = atof( woffset.c_str() ) * SGD_DEGREES_TO_RADIANS;
|
||||
}
|
||||
/* apparently not used (CLO, 11 Jun 2002)
|
||||
/* apparently not used (CLO, 11 Jun 2002)
|
||||
FGViewer *pilot_view =
|
||||
(FGViewer *)globals->get_viewmgr()->get_view( 0 ); */
|
||||
// this will work without calls to the viewer...
|
||||
|
@ -1317,7 +1317,7 @@ struct OptionDesc {
|
|||
const char *s_param;
|
||||
int (*func)( const char * );
|
||||
} fgOptionArray[] = {
|
||||
|
||||
|
||||
{"language", true, OPTION_FUNC, "", false, "", fgOptLanguage },
|
||||
{"disable-game-mode", false, OPTION_BOOL, "/sim/startup/game-mode", false, "", 0 },
|
||||
{"enable-game-mode", false, OPTION_BOOL, "/sim/startup/game-mode", true, "", 0 },
|
||||
|
@ -1464,6 +1464,9 @@ struct OptionDesc {
|
|||
{"proxy", true, OPTION_FUNC, "", false, "", fgSetupProxy },
|
||||
{"callsign", true, OPTION_FUNC, "", false, "", fgOptCallSign},
|
||||
{"multiplay", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
#ifdef FG_HAVE_HLA
|
||||
{"hla", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
#endif
|
||||
{"trace-read", true, OPTION_FUNC, "", false, "", fgOptTraceRead },
|
||||
{"trace-write", true, OPTION_FUNC, "", false, "", fgOptTraceWrite },
|
||||
{"log-level", true, OPTION_FUNC, "", false, "", fgOptLogLevel },
|
||||
|
@ -1756,7 +1759,7 @@ fgParseOptions (const string& path) {
|
|||
line = line.substr( 0, i );
|
||||
|
||||
if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
|
||||
cerr << endl << "Config file parse error: " << path << " '"
|
||||
cerr << endl << "Config file parse error: " << path << " '"
|
||||
<< line << "'" << endl;
|
||||
fgUsage();
|
||||
exit(-1);
|
||||
|
@ -1767,7 +1770,7 @@ fgParseOptions (const string& path) {
|
|||
|
||||
|
||||
// Print usage message
|
||||
void
|
||||
void
|
||||
fgUsage (bool verbose)
|
||||
{
|
||||
SGPropertyNode *locale = globals->get_locale();
|
||||
|
@ -1784,7 +1787,7 @@ fgUsage (bool verbose)
|
|||
cout << "Make sure the file options.xml is located in the FlightGear base directory," << endl;
|
||||
cout << "and the location of the base directory is specified by setting $FG_ROOT or" << endl;
|
||||
cout << "by adding --fg-root=path as a program argument." << endl;
|
||||
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -1828,7 +1831,7 @@ fgUsage (bool verbose)
|
|||
tmp.append(", -");
|
||||
tmp.append(short_name->getStringValue());
|
||||
}
|
||||
|
||||
|
||||
if (tmp.size() <= 25) {
|
||||
msg+= " --";
|
||||
msg += tmp;
|
||||
|
|
|
@ -30,3 +30,7 @@ set(SOURCES
|
|||
|
||||
flightgear_component(Network "${SOURCES}")
|
||||
|
||||
if(RTI_FOUND)
|
||||
add_subdirectory(HLA)
|
||||
endif()
|
||||
|
||||
|
|
7
src/Network/HLA/CMakeLists.txt
Normal file
7
src/Network/HLA/CMakeLists.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
include(FlightGearComponent)
|
||||
|
||||
set(SOURCES
|
||||
hla.cxx
|
||||
)
|
||||
|
||||
flightgear_component(HLA "${SOURCES}")
|
8
src/Network/HLA/Makefile.am
Normal file
8
src/Network/HLA/Makefile.am
Normal file
|
@ -0,0 +1,8 @@
|
|||
noinst_LIBRARIES = libFGHLA.a
|
||||
|
||||
libFGHLA_a_SOURCES = \
|
||||
hla.cxx hla.hxx
|
||||
|
||||
libFGHLA_a_CPPFLAGS = $(HLA_CPPFLAGS)
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
1267
src/Network/HLA/hla.cxx
Normal file
1267
src/Network/HLA/hla.cxx
Normal file
File diff suppressed because it is too large
Load diff
62
src/Network/HLA/hla.hxx
Normal file
62
src/Network/HLA/hla.hxx
Normal file
|
@ -0,0 +1,62 @@
|
|||
//
|
||||
// Copyright (C) 2009 - 2010 Mathias Fröhlich <Mathias.Froehlich@web.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
|
||||
#ifndef _FG_HLA_HXX
|
||||
#define _FG_HLA_HXX
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/structure/SGSharedPtr.hxx>
|
||||
#include <simgear/props/props.hxx>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <Network/protocol.hxx>
|
||||
|
||||
namespace simgear {
|
||||
class HLAFederate;
|
||||
class HLAObjectClass;
|
||||
class HLAObjectInstance;
|
||||
}
|
||||
|
||||
class FGHLA : public FGProtocol {
|
||||
public:
|
||||
FGHLA(const std::vector<std::string>& tokens);
|
||||
virtual ~FGHLA();
|
||||
|
||||
virtual bool open();
|
||||
virtual bool process();
|
||||
virtual bool close();
|
||||
|
||||
private:
|
||||
/// All the utility classes we need currently
|
||||
class XMLConfigReader;
|
||||
|
||||
/// The configuration parameters extracted from the tokens in the constructor
|
||||
std::string _objectModelConfig;
|
||||
std::string _federation;
|
||||
std::string _federate;
|
||||
|
||||
/// The toplevel rti class
|
||||
SGSharedPtr<simgear::HLAFederate> _hlaFederate;
|
||||
/// This class that is used to send register the local instance
|
||||
SGSharedPtr<simgear::HLAObjectClass> _localAircraftClass;
|
||||
/// The local aircraft instance
|
||||
SGSharedPtr<simgear::HLAObjectInstance> _localAircraftInstance;
|
||||
};
|
||||
|
||||
#endif // _FG_HLA_HXX
|
|
@ -40,3 +40,7 @@ libNetwork_a_SOURCES = \
|
|||
generic.hxx generic.cxx
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
||||
|
||||
if WITH_HLA
|
||||
SUBDIRS = HLA
|
||||
endif
|
Loading…
Add table
Reference in a new issue