From 6c111f55aa0b16831db3d44b6b9b2efe87707c5b Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Thu, 8 Nov 2012 21:31:16 +0100 Subject: [PATCH] hla: Warn about creating an object class or interactions classes twice. --- simgear/hla/HLAOMTXmlVisitor.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/simgear/hla/HLAOMTXmlVisitor.cxx b/simgear/hla/HLAOMTXmlVisitor.cxx index bf719d09..ee96f8d5 100644 --- a/simgear/hla/HLAOMTXmlVisitor.cxx +++ b/simgear/hla/HLAOMTXmlVisitor.cxx @@ -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 = 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 = federate.createObjectClass(objectClass->getName()); -- 2.39.5