From: Mathias Froehlich Date: Thu, 8 Nov 2012 20:31:16 +0000 (+0100) Subject: hla: Warn about creating an object class or interactions classes twice. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6c111f55aa0b16831db3d44b6b9b2efe87707c5b;p=simgear.git hla: Warn about creating an object class or interactions classes twice. --- 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());