2025-08-14 18:50:13 -04:00
|
|
|
#include "xcomworld.h"
|
2025-08-14 17:30:25 -04:00
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
XComWorld::XComWorld()
|
2025-08-14 18:50:13 -04:00
|
|
|
: XAsset()
|
|
|
|
|
, mName(new XString())
|
2025-08-14 17:30:25 -04:00
|
|
|
, mInUse(false)
|
|
|
|
|
, mPrimaryLightCount(-1)
|
2025-08-14 18:50:13 -04:00
|
|
|
, mPrimaryLights(new XComPrimaryLightArray())
|
2025-09-05 18:35:17 -04:00
|
|
|
{
|
|
|
|
|
SetType(ASSET_TYPE_COMWORLD);
|
2025-09-10 21:58:26 -04:00
|
|
|
SetName("Com World");
|
2025-09-05 18:35:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XComWorld::~XComWorld()
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
void XComWorld::Clear()
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
for (int i = 0; i < mPrimaryLights->size(); i++)
|
|
|
|
|
{
|
|
|
|
|
delete mPrimaryLights->at(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete mPrimaryLights;
|
|
|
|
|
delete mName;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-10 21:58:26 -04:00
|
|
|
void XComWorld::ParseData(XDataStream *aStream)
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
mName->ParsePtr(aStream, false);
|
|
|
|
|
|
|
|
|
|
quint32 primaryLightPtr;
|
|
|
|
|
*aStream
|
|
|
|
|
>> mInUse
|
|
|
|
|
>> mPrimaryLightCount
|
|
|
|
|
>> primaryLightPtr;
|
|
|
|
|
|
|
|
|
|
mName->ParseData(aStream);
|
|
|
|
|
|
|
|
|
|
if (primaryLightPtr)
|
|
|
|
|
{
|
|
|
|
|
if (mPrimaryLights != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete mPrimaryLights;
|
|
|
|
|
}
|
2025-08-14 18:50:13 -04:00
|
|
|
mPrimaryLights = XComPrimaryLight::ParseArray(aStream, mPrimaryLightCount);
|
2025-08-14 17:30:25 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
QString XComWorld::GetName() const
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
return mName->GetString();
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
bool XComWorld::IsInUse() const
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
return mInUse;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
quint32 XComWorld::GetPrimaryLightCount() const
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
return mPrimaryLightCount;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
XComPrimaryLight *XComWorld::GetPrimaryLight(quint32 aIndex) const
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
return mPrimaryLights->at(aIndex);
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
XComPrimaryLightArray *XComWorld::GetPrimaryLights() const
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
return mPrimaryLights;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
void XComWorld::SetName(const QString &aName)
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
if (aName != nullptr)
|
|
|
|
|
{
|
|
|
|
|
mName->SetString(aName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
void XComWorld::SetName(XString* aName)
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
if (aName != nullptr)
|
|
|
|
|
{
|
|
|
|
|
mName = aName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
void XComWorld::SetInUse(bool aInUse)
|
2025-08-14 17:30:25 -04:00
|
|
|
{
|
|
|
|
|
mInUse = aInUse;
|
|
|
|
|
}
|