#include "xpathnodedynamic.h"

XPathNodeDynamic::XPathNodeDynamic()
    : XAsset()
    , mOwner(new XSentientHandle())
    , mFreeTime(0)
    , mValidTime()
    , mPlayerLostTime(0)
    , mLinkCount(0)
    , mOverlapCount(0)
    , mTurretEntNumber(0)
    , mUserCount(0)
{
}

XPathNodeDynamic::~XPathNodeDynamic()
{

}

void XPathNodeDynamic::ParseData(QDataStream *aStream) {
    if (GetPtr() == -1) {
        qint32 nodePtr;
        *aStream
            >> nodePtr
            >> mFreeTime
            >> mValidTime[0]
            >> mValidTime[1]
            >> mValidTime[2]
            >> mPlayerLostTime
            >> mLinkCount
            >> mOverlapCount
            >> mTurretEntNumber
            >> mUserCount;
    }
}

void XPathNodeDynamic::Clear()
{
    mFreeTime = 0;
    mValidTime = QVector<int>();
    mPlayerLostTime = 0;
    mLinkCount = 0;
    mOverlapCount = 0;
    mTurretEntNumber = 0;
    mUserCount = 0;
}

XSentientHandle *XPathNodeDynamic::GetOwner() const {
    return mOwner;
}

void XPathNodeDynamic::SetOwner(XSentientHandle* owner) {
    mOwner = owner;
}

int XPathNodeDynamic::GetFreeTime() const {
    return mFreeTime;
}

void XPathNodeDynamic::SetFreeTime(int time) {
    mFreeTime = time;
}

QVector<int> XPathNodeDynamic::GetValidTime() const {
    return mValidTime;
}

void XPathNodeDynamic::SetValidTime(QVector<int> aValidTime) {
    mValidTime = aValidTime;
}

int XPathNodeDynamic::GetPlayerLostTime() const {
    return mPlayerLostTime;
}

void XPathNodeDynamic::SetPlayerLostTime(int time) {
    mPlayerLostTime = time;
}

short XPathNodeDynamic::GetLinkCount() const {
    return mLinkCount;
}

void XPathNodeDynamic::SetLinkCount(short count) {
    mLinkCount = count;
}

short XPathNodeDynamic::GetOverlapCount() const {
    return mOverlapCount;
}

void XPathNodeDynamic::SetOverlapCount(short count) {
    mOverlapCount = count;
}

short XPathNodeDynamic::GetTurretEntNumber() const {
    return mTurretEntNumber;
}

void XPathNodeDynamic::SetTurretEntNumber(short number) {
    mTurretEntNumber = number;
}

short XPathNodeDynamic::GetUserCount() const {
    return mUserCount;
}

void XPathNodeDynamic::SetUserCount(short count) {
    mUserCount = count;
}
