hla: Fix the way derived classes accumulate attributes.

This commit is contained in:
Mathias Froehlich 2012-03-04 19:56:43 +01:00
parent f5067b058c
commit 036c0034c3

View File

@ -529,29 +529,27 @@ HLAOMTXmlVisitor::endXML()
throw sg_exception("Internal parse error!");
// propagate parent attributes to the derived classes
// Note that this preserves the order og the attributes starting from the root object
// Note that this preserves the order of the attributes starting from the root object
for (ObjectClassList::const_iterator i = _objectClassList.begin(); i != _objectClassList.end(); ++i) {
SGSharedPtr<const ObjectClass> objectClass = (*i)->_parentObjectClass;
while (objectClass) {
if (!objectClass.valid())
continue;
for (AttributeList::const_reverse_iterator j = objectClass->_attributes.rbegin();
j != objectClass->_attributes.rend(); ++j) {
(*i)->_attributes.insert((*i)->_attributes.begin(), *j);
}
objectClass = objectClass->_parentObjectClass;
}
}
// propagate parent parameter to the derived interactions
// Note that this preserves the order og the parameters starting from the root object
// Note that this preserves the order of the parameters starting from the root object
for (InteractionClassList::const_iterator i = _interactionClassList.begin(); i != _interactionClassList.end(); ++i) {
SGSharedPtr<const InteractionClass> interactionClass = (*i)->_parentInteractionClass;
while (interactionClass) {
if (!interactionClass.valid())
continue;
for (ParameterList::const_reverse_iterator j = interactionClass->_parameters.rbegin();
j != interactionClass->_parameters.rend(); ++j) {
(*i)->_parameters.insert((*i)->_parameters.begin(), *j);
}
interactionClass = interactionClass->_parentInteractionClass;
}
}
}