From: Mathias Froehlich Date: Sun, 25 Nov 2012 21:24:51 +0000 (+0100) Subject: hla: For setting data types recurse into array data elements. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1a68d34663592658c0688c379751fd066fe73dab;p=simgear.git hla: For setting data types recurse into array data elements. --- diff --git a/simgear/hla/HLAArrayDataElement.cxx b/simgear/hla/HLAArrayDataElement.cxx index 191a84eb..1d7f40d5 100644 --- a/simgear/hla/HLAArrayDataElement.cxx +++ b/simgear/hla/HLAArrayDataElement.cxx @@ -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) { diff --git a/simgear/hla/HLAArrayDataElement.hxx b/simgear/hla/HLAArrayDataElement.hxx index 9bdd7105..3bfa8b74 100644 --- a/simgear/hla/HLAArrayDataElement.hxx +++ b/simgear/hla/HLAArrayDataElement.hxx @@ -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;