]> git.mxchange.org Git - simgear.git/commitdiff
hla: For setting data types recurse into array data elements.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Sun, 25 Nov 2012 21:24:51 +0000 (22:24 +0100)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Sun, 25 Nov 2012 21:27:14 +0000 (22:27 +0100)
simgear/hla/HLAArrayDataElement.cxx
simgear/hla/HLAArrayDataElement.hxx

index 191a84eb1d766130bcbe0c789c710526d1c923e5..1d7f40d5b06be4dbf858904a550a6abdf175a561 100644 (file)
@@ -156,6 +156,21 @@ HLAArrayDataElement::getDataElement(HLADataElementIndex::const_iterator begin, H
     return dataElement->getDataElement(++begin, end);
 }
 
+bool
+HLAArrayDataElement::setDataType(const HLADataType* dataType)
+{
+    if (!HLAAbstractArrayDataElement::setDataType(dataType))
+        return false;
+    for (unsigned i = 0; i < getNumElements(); ++i) {
+        HLADataElement* dataElement = getElement(i);
+        if (!dataElement)
+            continue;
+        if (!dataElement->setDataType(getElementDataType()))
+            return false;
+    }
+    return true;
+}
+
 bool
 HLAArrayDataElement::setNumElements(unsigned size)
 {
index 9bdd71054f87be3cc5ffea6629eac86497b423c9..3bfa8b740892de1966b244e71d7d61bc8db4149a 100644 (file)
@@ -63,6 +63,8 @@ public:
     virtual HLADataElement* getDataElement(HLADataElementIndex::const_iterator begin, HLADataElementIndex::const_iterator end);
     virtual const HLADataElement* getDataElement(HLADataElementIndex::const_iterator begin, HLADataElementIndex::const_iterator end) const;
 
+    virtual bool setDataType(const HLADataType* dataType);
+
     virtual bool setNumElements(unsigned size);
     virtual bool decodeElement(HLADecodeStream& stream, unsigned i);
     virtual unsigned getNumElements() const;