]> git.mxchange.org Git - flightgear.git/commitdiff
Adapt to recent simgear hla/rti changes.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Tue, 30 Aug 2011 19:51:53 +0000 (21:51 +0200)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Wed, 31 Aug 2011 18:02:00 +0000 (20:02 +0200)
configure.ac
src/Main/CMakeLists.txt
src/Network/HLA/hla.cxx

index e1725ce504531adc4f5e8dd83b932d7541355ea6..25e73b4e3c7d189e4a82a292a2d1a73eef1750f1 100644 (file)
@@ -263,29 +263,30 @@ if test "x$with_rti13" != "xno"; then
     AC_MSG_CHECKING([for simgear HLA/RTI support])
     AC_LANG_PUSH(C++)
     AC_TRY_COMPILE([
-        #include <simgear/hla/HLA13Federate.hxx>
+        #include <simgear/hla/HLAFederate.hxx>
         ],[
-        new simgear::HLA13Federate;
+        new simgear::HLAFederate;
         ], 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"
         saved_LDFLAGS="$LDFLAGS"
+        have_rti13=no
         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"
+                LIBS="-lsghla -lsgrti13 -lsgrti -lsgxml -lsgstructure -lsgmath -lsgdebug -lsgtiming $rti13libs -lrt $saved_LIBS"
                 LDFLAGS="$HLA_LDFLAGS $saved_LDFLAGS"
                 AC_TRY_LINK([
-                    #include <simgear/hla/HLA13Federate.hxx>
+                    #include <simgear/hla/HLAFederate.hxx>
                     ],[
-                    new simgear::HLA13Federate;
+                    new simgear::HLAFederate;
                     ], [hla_libs="$rti13libs"; have_rti13=yes],)
             fi
         done
         LIBS="$saved_LIBS"
         LDFLAGS="$saved_LDFLAGS"
-        AC_MSG_RESULT($hla_libs)
+        AC_MSG_RESULT($have_rti13)
     fi
     AC_LANG_POP()
 fi
@@ -293,7 +294,7 @@ 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")
+    AC_SUBST(HLA_LIBS, "-lsghla -lsgrti13 -lsgrti $hla_libs")
 fi
 
 dnl EXPERIMENTAL fgpanel application
index 2f80a23f625fa480b25acbcd843af31b52b6e187..5818335d36ef1b3c5f7ca3378b9ebb98f3f507af 100644 (file)
@@ -61,24 +61,25 @@ get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
 #message(STATUS "SG libs ${SIMGEAR_LIBRARIES}")
 
 if(RTI_FOUND)
-  find_sg_component(hla13 SIMGEAR_LIBRARIES)
   find_sg_component(hla SIMGEAR_LIBRARIES)
+  find_sg_component(rti13 SIMGEAR_LIBRARIES)
+  find_sg_component(rti SIMGEAR_LIBRARIES)
   set(HLA_LIBRARIES ${RTI_LIBRARIES})
 else()
   set(HLA_LIBRARIES "")
 endif()
 
-target_link_libraries(fgfs 
+target_link_libraries(fgfs
        ${FG_LIBS}
        ${HLA_LIBRARIES}
        ${SIMGEAR_LIBRARIES}
-       ${OPENSCENEGRAPH_LIBRARIES} 
-       ${OPENAL_LIBRARY} 
+       ${OPENSCENEGRAPH_LIBRARIES}
+       ${OPENAL_LIBRARY}
        ${OPENGL_LIBRARIES}
-       ${ALUT_LIBRARY} 
+       ${ALUT_LIBRARY}
        ${ZLIB_LIBRARIES}
        ${PLIB_LIBRARIES}
        ${LIBSVN_LIBRARIES}
        ${RT_LIBRARY})
-       
+
 install(TARGETS fgfs RUNTIME DESTINATION bin)
index cf6af5effdebf480c52d92e91bdf1851b6c657d5..8d6b696a8c3c00027f5ebee1bafdff9adc94b50f 100644 (file)
@@ -37,7 +37,7 @@
 #include <simgear/structure/exception.hxx>
 #include <simgear/xml/easyxml.hxx>
 
-#include <simgear/hla/HLA13Federate.hxx>
+#include <simgear/hla/HLAFederate.hxx>
 #include <simgear/hla/HLAArrayDataElement.hxx>
 #include <simgear/hla/HLADataElement.hxx>
 #include <simgear/hla/HLADataType.hxx>
@@ -77,7 +77,7 @@ public:
 
     HLAVersion getRTIVersion() const
     { return _rtiVersion; }
-    const std::vector<std::string>& getRTIArguments() const
+    const std::list<std::string>& getRTIArguments() const
     { return _rtiArguments; }
 
     struct DataElement {
@@ -318,7 +318,7 @@ private:
 
     std::string _federateObjectModel;
     HLAVersion _rtiVersion;
-    std::vector<std::string> _rtiArguments;
+    std::list<std::string> _rtiArguments;
 
     ObjectClassConfigList _objectClassConfigList;
 };
@@ -818,7 +818,8 @@ private:
     sg::HLADataElement::IndexPathPair _mpPropertiesIndexPathPair;
 };
 
-FGHLA::FGHLA(const std::vector<std::string>& tokens)
+FGHLA::FGHLA(const std::vector<std::string>& tokens) :
+    _hlaFederate(new simgear::HLAFederate)
 {
     if (1 < tokens.size() && !tokens[1].empty())
         set_direction(tokens[1]);
@@ -919,14 +920,23 @@ FGHLA::open()
     // We need that to communicate to the rti
     switch (configReader.getRTIVersion()) {
     case RTI13:
-        _hlaFederate = new simgear::HLA13Federate;
+        if (!_hlaFederate->connect(simgear::HLAFederate::RTI13, configReader.getRTIArguments())) {
+            SG_LOG(SG_IO, SG_ALERT, "Could not connect to RTI13 federation.");
+            return false;
+        }
         break;
     case RTI1516:
-        SG_LOG(SG_IO, SG_ALERT, "HLA version RTI1516 not yet(!?) supported.");
-        return false;
+        if (!_hlaFederate->connect(simgear::HLAFederate::RTI1516, configReader.getRTIArguments())) {
+            SG_LOG(SG_IO, SG_ALERT, "Could not connect to RTI1516 federation.");
+            return false;
+        }
+        break;
     case RTI1516E:
-        SG_LOG(SG_IO, SG_ALERT, "HLA version RTI1516E not yet(!?) supported.");
-        return false;
+        if (!_hlaFederate->connect(simgear::HLAFederate::RTI1516E, configReader.getRTIArguments())) {
+            SG_LOG(SG_IO, SG_ALERT, "Could not connect to RTI1516E federation.");
+            return false;
+        }
+        break;
     }
 
     // Try to create a new federation execution
@@ -1264,7 +1274,7 @@ FGHLA::close()
     _hlaFederate->destroyFederationExecution(_federation);
 
     // throw away the HLAFederate
-    _hlaFederate = 0;
+    _hlaFederate->disconnect();
 
     set_enabled(false);