]> git.mxchange.org Git - simgear.git/commitdiff
hla: Warn about creating an object class or interactions classes twice.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Thu, 8 Nov 2012 20:31:16 +0000 (21:31 +0100)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Thu, 8 Nov 2012 21:50:26 +0000 (22:50 +0100)
simgear/hla/HLAOMTXmlVisitor.cxx

index bf719d09bae2cbc6c5385449a08cd8e7dcbb044e..ee96f8d53a3559124cb5cf6942053f14f0517560 100644 (file)
@@ -178,6 +178,10 @@ HLAOMTXmlVisitor::setToFederate(HLAFederate& federate)
     unsigned numInteractionClasses = getNumInteractionClasses();
     for (unsigned i = 0; i < numInteractionClasses; ++i) {
         const InteractionClass* interactionClass = getInteractionClass(i);
+        if (federate.getInteractionClass(interactionClass->getName())) {
+            SG_LOG(SG_IO, SG_ALERT, "Not creating Interaction class \"" << interactionClass->getName() << "\" twice!.");
+            continue;
+        }
 
         SGSharedPtr<HLAInteractionClass> hlaInteractionClass;
         hlaInteractionClass = federate.createInteractionClass(interactionClass->getName());
@@ -201,6 +205,10 @@ HLAOMTXmlVisitor::setToFederate(HLAFederate& federate)
     unsigned numObjectClasses = getNumObjectClasses();
     for (unsigned i = 0; i < numObjectClasses; ++i) {
         const ObjectClass* objectClass = getObjectClass(i);
+        if (federate.getObjectClass(objectClass->getName())) {
+            SG_LOG(SG_IO, SG_ALERT, "Not creating Object class \"" << objectClass->getName() << "\" twice!.");
+            continue;
+        }
 
         SGSharedPtr<HLAObjectClass> hlaObjectClass;
         hlaObjectClass = federate.createObjectClass(objectClass->getName());