#include "xcollisionborder.h"

XCollisionBorder::XCollisionBorder()
    : XAsset()
    , mDistEq(3)   // Always 3 elements
    , mZBase(0.0f)
    , mZSlope(0.0f)
    , mStart(0.0f)
    , mLength(0.0f)
{
    SetName("Collision Border");
}

XCollisionBorder::~XCollisionBorder()
{
}

void XCollisionBorder::ParseData(XDataStream *aStream)
{
    if (GetPtr() == -1)
    {
        // Distance equation components
        mDistEq[0] = aStream->ParseSingle(QString("%1 dist eq x").arg(GetName()));
        mDistEq[1] = aStream->ParseSingle(QString("%1 dist eq y").arg(GetName()));
        mDistEq[2] = aStream->ParseSingle(QString("%1 dist eq z").arg(GetName()));

        // Other properties
        mZBase = aStream->ParseSingle(QString("%1 z base").arg(GetName()));
        mZSlope = aStream->ParseSingle(QString("%1 z slope").arg(GetName()));
        mStart = aStream->ParseSingle(QString("%1 start").arg(GetName()));
        mLength = aStream->ParseSingle(QString("%1 length").arg(GetName()));
    }
}

void XCollisionBorder::Clear()
{
    mDistEq.clear();
    mZBase = 0.0f;
    mZSlope = 0.0f;
    mStart = 0.0f;
    mLength = 0.0f;
}
