#include "xpathnodeconstant.h"

XPathNodeConstant::XPathNodeConstant()
    : XAsset()
    , mType(XNodeType::NODE_BADNODE)
    , mSpawnflags(0)
    , mTargetname(0)
    , mScriptLinkName(0)
    , mScriptNoteworthy(0)
    , mTarget(0)
    , mAnimscript(0)
    , mAnimscriptfunc(0)
    , mOrigin()
    , mAngle(0.0f)
    , mForward()
    , mRadius(0.0f)
    , mMinUseDistSq(0.0f)
    , mOverlapNode()
    , mChainId(0)
    , mChainDepth(0)
    , mChainParent(0)
    , mTotalLinkCount(0)
    , mLinks()
{
}

XPathNodeConstant::~XPathNodeConstant()
{

}

void XPathNodeConstant::ParseData(QDataStream *aStream) {
    if (GetPtr() == -1) {
        int typeInt;
        *aStream >> typeInt;
        mType = static_cast<XNodeType>(typeInt);

        *aStream
            >> mSpawnflags
            >> mTargetname
            >> mScriptLinkName
            >> mScriptNoteworthy
            >> mTarget
            >> mAnimscript
            >> mAnimscriptfunc
            >> mOrigin[0]
            >> mOrigin[1]
            >> mOrigin[2]
            >> mAngle
            >> mForward[0]
            >> mForward[1]
            >> mRadius
            >> mMinUseDistSq
            >> mOverlapNode
            >> mChainId
            >> mChainDepth
            >> mChainParent
            >> mTotalLinkCount;

        for (unsigned short i = 0; i < mTotalLinkCount; ++i) {
            XPathLink newLink;
            newLink.ParseData(aStream);
            mLinks.append(newLink);
        }
    }
}

void XPathNodeConstant::Clear()
{

}
