]> git.mxchange.org Git - simgear.git/blobdiff - simgear/hla/HLAFederate.cxx
hla: Add convenience function to set version by string.
[simgear.git] / simgear / hla / HLAFederate.cxx
index 94e8b3a289b46a24bf4c19a13b6c425d95c6996f..8cd173ad53ec0f1abb99d465dd7d8bdbb9a1b46e 100644 (file)
@@ -78,6 +78,22 @@ HLAFederate::setVersion(HLAFederate::Version version)
     return true;
 }
 
+bool
+HLAFederate::setVersion(const std::string& version)
+{
+    if (version == "RTI13")
+        return setVersion(RTI13);
+    else if (version == "RTI1516")
+        return setVersion(RTI1516);
+    else if (version == "RTI1516E")
+        return setVersion(RTI1516E);
+    else {
+        /// at some time think about routing these down to the factory
+        SG_LOG(SG_NETWORK, SG_ALERT, "HLA: Unknown version string in HLAFederate::setVersion!");
+        return false;
+    }
+}
+
 const std::list<std::string>&
 HLAFederate::getConnectArguments() const
 {