#include "xsoundaliaslist.h"

XSoundAliasList::XSoundAliasList()
    : XAsset()
    , mAliasName()
    , mAliases()
    , mCount(0)
{
    SetType(ASSET_TYPE_SOUND);
    SetName("Sound Alias List");
}

XSoundAliasList::~XSoundAliasList()
{

}

void XSoundAliasList::Clear()
{
    mAliasName.Clear();
    mAliases.clear();
    mCount = 0;
}

void XSoundAliasList::ParseData(XDataStream *aStream)
{
    if (GetPtr() == -1)
    {
        mAliasName.ParsePtr(aStream, false);

        qint32 headPtr;
        *aStream
            >> headPtr
            >> mCount;

        mAliasName.ParseData(aStream);

        if (headPtr == -1)
        {
            for (int i = 0; i < mCount; i++)
            {
                XSoundAlias newAlias;
                newAlias.ParseData(aStream);
                mAliases.append(newAlias);
            }
        }
    }
}
