hla: Fix the way derived classes accumulate attributes.
This commit is contained in:
parent
f5067b058c
commit
036c0034c3
@ -529,29 +529,27 @@ HLAOMTXmlVisitor::endXML()
|
|||||||
throw sg_exception("Internal parse error!");
|
throw sg_exception("Internal parse error!");
|
||||||
|
|
||||||
// propagate parent attributes to the derived classes
|
// 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) {
|
for (ObjectClassList::const_iterator i = _objectClassList.begin(); i != _objectClassList.end(); ++i) {
|
||||||
SGSharedPtr<const ObjectClass> objectClass = (*i)->_parentObjectClass;
|
SGSharedPtr<const ObjectClass> objectClass = (*i)->_parentObjectClass;
|
||||||
while (objectClass) {
|
if (!objectClass.valid())
|
||||||
|
continue;
|
||||||
for (AttributeList::const_reverse_iterator j = objectClass->_attributes.rbegin();
|
for (AttributeList::const_reverse_iterator j = objectClass->_attributes.rbegin();
|
||||||
j != objectClass->_attributes.rend(); ++j) {
|
j != objectClass->_attributes.rend(); ++j) {
|
||||||
(*i)->_attributes.insert((*i)->_attributes.begin(), *j);
|
(*i)->_attributes.insert((*i)->_attributes.begin(), *j);
|
||||||
}
|
}
|
||||||
objectClass = objectClass->_parentObjectClass;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// propagate parent parameter to the derived interactions
|
// 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) {
|
for (InteractionClassList::const_iterator i = _interactionClassList.begin(); i != _interactionClassList.end(); ++i) {
|
||||||
SGSharedPtr<const InteractionClass> interactionClass = (*i)->_parentInteractionClass;
|
SGSharedPtr<const InteractionClass> interactionClass = (*i)->_parentInteractionClass;
|
||||||
while (interactionClass) {
|
if (!interactionClass.valid())
|
||||||
|
continue;
|
||||||
for (ParameterList::const_reverse_iterator j = interactionClass->_parameters.rbegin();
|
for (ParameterList::const_reverse_iterator j = interactionClass->_parameters.rbegin();
|
||||||
j != interactionClass->_parameters.rend(); ++j) {
|
j != interactionClass->_parameters.rend(); ++j) {
|
||||||
(*i)->_parameters.insert((*i)->_parameters.begin(), *j);
|
(*i)->_parameters.insert((*i)->_parameters.begin(), *j);
|
||||||
}
|
}
|
||||||
interactionClass = interactionClass->_parentInteractionClass;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user