mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-07-01 00:57:56 -05:00
Save scriptstrings per zone and not per asset since that solves all problems with multiple assets of the same zone referencing the same struct in memory that has scriptstring indices
This commit is contained in:
@ -5,11 +5,17 @@ const void* ContentLoaderBase::PTR_FOLLOWING = reinterpret_cast<void*>(-1);
|
||||
const void* ContentLoaderBase::PTR_INSERT = reinterpret_cast<void*>(-2);
|
||||
|
||||
ContentLoaderBase::ContentLoaderBase()
|
||||
: varXString(nullptr),
|
||||
m_zone(nullptr),
|
||||
m_stream(nullptr)
|
||||
{
|
||||
varXString = nullptr;
|
||||
}
|
||||
|
||||
m_zone = nullptr;
|
||||
m_stream = nullptr;
|
||||
ContentLoaderBase::ContentLoaderBase(Zone* zone, IZoneInputStream* stream)
|
||||
: varXString(nullptr),
|
||||
m_zone(zone),
|
||||
m_stream(stream)
|
||||
{
|
||||
}
|
||||
|
||||
void ContentLoaderBase::LoadXString(const bool atStreamStart) const
|
||||
@ -19,9 +25,9 @@ void ContentLoaderBase::LoadXString(const bool atStreamStart) const
|
||||
if (atStreamStart)
|
||||
m_stream->Load<const char*>(varXString);
|
||||
|
||||
if(*varXString != nullptr)
|
||||
if (*varXString != nullptr)
|
||||
{
|
||||
if(*varXString == PTR_FOLLOWING)
|
||||
if (*varXString == PTR_FOLLOWING)
|
||||
{
|
||||
*varXString = m_stream->Alloc<const char>(alignof(const char));
|
||||
m_stream->LoadNullTerminated(const_cast<char*>(*varXString));
|
||||
@ -37,12 +43,12 @@ void ContentLoaderBase::LoadXStringArray(const bool atStreamStart, const size_t
|
||||
{
|
||||
assert(varXString != nullptr);
|
||||
|
||||
if(atStreamStart)
|
||||
if (atStreamStart)
|
||||
m_stream->Load<const char*>(varXString, count);
|
||||
|
||||
for(size_t index = 0; index < count; index++)
|
||||
for (size_t index = 0; index < count; index++)
|
||||
{
|
||||
LoadXString(false);
|
||||
varXString++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user