refactor: use zone reference in AssetLoader

This commit is contained in:
Jan 2025-05-02 11:19:52 +01:00
parent 50612d117e
commit 9e940a6f53
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
49 changed files with 173 additions and 160 deletions

View File

@ -240,7 +240,7 @@ namespace
void PrintHeaderConstructor() const void PrintHeaderConstructor() const
{ {
LINEF("{0}(Zone* zone, IZoneInputStream* stream);", LoaderClassName(m_env.m_asset)) LINEF("{0}(Zone& zone, IZoneInputStream* stream);", LoaderClassName(m_env.m_asset))
} }
void PrintVariableInitialization(const DataDefinition* def) const void PrintVariableInitialization(const DataDefinition* def) const
@ -255,7 +255,7 @@ namespace
void PrintConstructorMethod() void PrintConstructorMethod()
{ {
LINEF("{0}::{0}(Zone* zone, IZoneInputStream* stream)", LoaderClassName(m_env.m_asset)) LINEF("{0}::{0}(Zone& zone, IZoneInputStream* stream)", LoaderClassName(m_env.m_asset))
m_intendation++; m_intendation++;
LINE_STARTF(": AssetLoader({0}::EnumEntry, zone, stream)", m_env.m_asset->m_asset_name) LINE_STARTF(": AssetLoader({0}::EnumEntry, zone, stream)", m_env.m_asset->m_asset_name)
@ -1269,7 +1269,7 @@ namespace
LINEF("{0} marker(m_zone);", MarkerClassName(m_env.m_asset)) LINEF("{0} marker(m_zone);", MarkerClassName(m_env.m_asset))
LINE("marker.Mark(*pAsset);") LINE("marker.Mark(*pAsset);")
LINE("") LINE("")
LINEF("auto* reallocatedAsset = m_zone->GetMemory()->Alloc<{0}>();", info->m_definition->GetFullName()) LINEF("auto* reallocatedAsset = m_zone.GetMemory()->Alloc<{0}>();", info->m_definition->GetFullName())
LINEF("std::memcpy(reallocatedAsset, *pAsset, sizeof({0}));", info->m_definition->GetFullName()) LINEF("std::memcpy(reallocatedAsset, *pAsset, sizeof({0}));", info->m_definition->GetFullName())
LINE("") LINE("")
LINEF("m_asset_info = reinterpret_cast<XAssetInfo<{0}>*>(LinkAsset(AssetNameAccessor<{1}>()(**pAsset), reallocatedAsset, marker.GetDependencies(), " LINEF("m_asset_info = reinterpret_cast<XAssetInfo<{0}>*>(LinkAsset(AssetNameAccessor<{1}>()(**pAsset), reallocatedAsset, marker.GetDependencies(), "

View File

@ -215,7 +215,7 @@ namespace
void PrintHeaderConstructor() const void PrintHeaderConstructor() const
{ {
LINEF("{0}(Zone* zone);", MarkerClassName(m_env.m_asset)) LINEF("{0}(Zone& zone);", MarkerClassName(m_env.m_asset))
} }
void PrintHeaderMainMarkMethodDeclaration(const StructureInformation* info) const void PrintHeaderMainMarkMethodDeclaration(const StructureInformation* info) const
@ -235,7 +235,7 @@ namespace
void PrintConstructorMethod() void PrintConstructorMethod()
{ {
LINEF("{0}::{0}(Zone* zone)", MarkerClassName(m_env.m_asset)) LINEF("{0}::{0}(Zone& zone)", MarkerClassName(m_env.m_asset))
m_intendation++; m_intendation++;
LINEF(": AssetMarker({0}::EnumEntry, zone)", m_env.m_asset->m_asset_name) LINEF(": AssetMarker({0}::EnumEntry, zone)", m_env.m_asset->m_asset_name)

View File

@ -32,8 +32,9 @@
using namespace IW3; using namespace IW3;
ContentLoader::ContentLoader() ContentLoader::ContentLoader(Zone& zone)
: varXAsset(nullptr), : ContentLoaderBase(zone),
varXAsset(nullptr),
varScriptStringList(nullptr) varScriptStringList(nullptr)
{ {
} }
@ -54,12 +55,12 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart)
LoadXStringArray(true, varScriptStringList->count); LoadXStringArray(true, varScriptStringList->count);
if (varScriptStringList->strings && varScriptStringList->count > 0) if (varScriptStringList->strings && varScriptStringList->count > 0)
m_zone->m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count)); m_zone.m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count));
} }
m_stream->PopBlock(); m_stream->PopBlock();
assert(m_zone->m_script_strings.Count() <= SCR_STRING_MAX + 1); assert(m_zone.m_script_strings.Count() <= SCR_STRING_MAX + 1);
} }
void ContentLoader::LoadXAsset(const bool atStreamStart) const void ContentLoader::LoadXAsset(const bool atStreamStart) const
@ -133,9 +134,8 @@ void ContentLoader::LoadXAssetArray(const bool atStreamStart, const size_t count
} }
} }
void ContentLoader::Load(Zone* zone, IZoneInputStream* stream) void ContentLoader::Load(IZoneInputStream* stream)
{ {
m_zone = zone;
m_stream = stream; m_stream = stream;
m_stream->PushBlock(XFILE_BLOCK_VIRTUAL); m_stream->PushBlock(XFILE_BLOCK_VIRTUAL);

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "Game/IW3/IW3.h" #include "Game/IW3/IW3.h"
#include "Loading/ContentLoaderBase.h" #include "Loading/ContentLoaderBase.h"
#include "Loading/IContentLoadingEntryPoint.h" #include "Loading/IContentLoadingEntryPoint.h"
@ -7,17 +8,18 @@ namespace IW3
{ {
class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint
{ {
XAsset* varXAsset; public:
ScriptStringList* varScriptStringList; explicit ContentLoader(Zone& zone);
void Load(IZoneInputStream* stream) override;
private:
void LoadScriptStringList(bool atStreamStart); void LoadScriptStringList(bool atStreamStart);
void LoadXAsset(bool atStreamStart) const; void LoadXAsset(bool atStreamStart) const;
void LoadXAssetArray(bool atStreamStart, size_t count); void LoadXAssetArray(bool atStreamStart, size_t count);
public: XAsset* varXAsset;
ContentLoader(); ScriptStringList* varScriptStringList;
void Load(Zone* zone, IZoneInputStream* stream) override;
}; };
} // namespace IW3 } // namespace IW3

View File

@ -5,7 +5,7 @@
using namespace IW3; using namespace IW3;
Actions_GfxImage::Actions_GfxImage(Zone* zone) Actions_GfxImage::Actions_GfxImage(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
{ {
const size_t loadDefSize = offsetof(IW3::GfxImageLoadDef, data) + loadDef->resourceSize; const size_t loadDefSize = offsetof(IW3::GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->AllocRaw(loadDefSize)); image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize); memcpy(image->texture.loadDef, loadDef, loadDefSize);
} }

View File

@ -8,7 +8,7 @@ namespace IW3
class Actions_GfxImage final : public AssetLoadingActions class Actions_GfxImage final : public AssetLoadingActions
{ {
public: public:
explicit Actions_GfxImage(Zone* zone); explicit Actions_GfxImage(Zone& zone);
void OnImageLoaded(GfxImage* image) const; void OnImageLoaded(GfxImage* image) const;
void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const;

View File

@ -4,7 +4,7 @@
using namespace IW3; using namespace IW3;
Actions_LoadedSound::Actions_LoadedSound(Zone* zone) Actions_LoadedSound::Actions_LoadedSound(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -14,7 +14,7 @@ void Actions_LoadedSound::SetSoundData(MssSound* sound) const
if (sound->info.data_len > 0) if (sound->info.data_len > 0)
{ {
const auto* tempData = sound->data; const auto* tempData = sound->data;
sound->data = m_zone->GetMemory()->Alloc<char>(sound->info.data_len); sound->data = m_zone.GetMemory()->Alloc<char>(sound->info.data_len);
memcpy(sound->data, tempData, sound->info.data_len); memcpy(sound->data, tempData, sound->info.data_len);
} }
else else

View File

@ -8,7 +8,7 @@ namespace IW3
class Actions_LoadedSound final : public AssetLoadingActions class Actions_LoadedSound final : public AssetLoadingActions
{ {
public: public:
explicit Actions_LoadedSound(Zone* zone); explicit Actions_LoadedSound(Zone& zone);
void SetSoundData(MssSound* sound) const; void SetSoundData(MssSound* sound) const;
}; };

View File

@ -85,8 +85,8 @@ std::unique_ptr<ZoneLoader> ZoneLoaderFactory::CreateLoaderForHeader(ZoneHeader&
zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>());
// Start of the zone content // Start of the zone content
zoneLoader->AddLoadingStep( zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(
std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); std::make_unique<ContentLoader>(*zonePtr), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
return zoneLoader; return zoneLoader;
} }

View File

@ -42,8 +42,9 @@
using namespace IW4; using namespace IW4;
ContentLoader::ContentLoader() ContentLoader::ContentLoader(Zone& zone)
: varXAsset(nullptr), : ContentLoaderBase(zone),
varXAsset(nullptr),
varScriptStringList(nullptr) varScriptStringList(nullptr)
{ {
} }
@ -64,12 +65,12 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart)
LoadXStringArray(true, varScriptStringList->count); LoadXStringArray(true, varScriptStringList->count);
if (varScriptStringList->strings && varScriptStringList->count > 0) if (varScriptStringList->strings && varScriptStringList->count > 0)
m_zone->m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count)); m_zone.m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count));
} }
m_stream->PopBlock(); m_stream->PopBlock();
assert(m_zone->m_script_strings.Count() <= SCR_STRING_MAX + 1); assert(m_zone.m_script_strings.Count() <= SCR_STRING_MAX + 1);
} }
void ContentLoader::LoadXAsset(const bool atStreamStart) const void ContentLoader::LoadXAsset(const bool atStreamStart) const
@ -153,9 +154,8 @@ void ContentLoader::LoadXAssetArray(const bool atStreamStart, const size_t count
} }
} }
void ContentLoader::Load(Zone* zone, IZoneInputStream* stream) void ContentLoader::Load(IZoneInputStream* stream)
{ {
m_zone = zone;
m_stream = stream; m_stream = stream;
m_stream->PushBlock(XFILE_BLOCK_VIRTUAL); m_stream->PushBlock(XFILE_BLOCK_VIRTUAL);

View File

@ -9,9 +9,9 @@ namespace IW4
class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint
{ {
public: public:
ContentLoader(); explicit ContentLoader(Zone& zone);
void Load(Zone* zone, IZoneInputStream* stream) override; void Load(IZoneInputStream* stream) override;
private: private:
void LoadScriptStringList(bool atStreamStart); void LoadScriptStringList(bool atStreamStart);

View File

@ -5,7 +5,7 @@
using namespace IW4; using namespace IW4;
Actions_GfxImage::Actions_GfxImage(Zone* zone) Actions_GfxImage::Actions_GfxImage(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
{ {
const size_t loadDefSize = offsetof(IW4::GfxImageLoadDef, data) + loadDef->resourceSize; const size_t loadDefSize = offsetof(IW4::GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->AllocRaw(loadDefSize)); image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize); memcpy(image->texture.loadDef, loadDef, loadDefSize);
} }

View File

@ -8,7 +8,7 @@ namespace IW4
class Actions_GfxImage final : public AssetLoadingActions class Actions_GfxImage final : public AssetLoadingActions
{ {
public: public:
explicit Actions_GfxImage(Zone* zone); explicit Actions_GfxImage(Zone& zone);
void OnImageLoaded(GfxImage* image) const; void OnImageLoaded(GfxImage* image) const;
void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const;

View File

@ -4,7 +4,7 @@
using namespace IW4; using namespace IW4;
Actions_LoadedSound::Actions_LoadedSound(Zone* zone) Actions_LoadedSound::Actions_LoadedSound(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -14,7 +14,7 @@ void Actions_LoadedSound::SetSoundData(MssSound* sound) const
if (sound->info.data_len > 0) if (sound->info.data_len > 0)
{ {
const auto* tempData = sound->data; const auto* tempData = sound->data;
sound->data = m_zone->GetMemory()->Alloc<char>(sound->info.data_len); sound->data = m_zone.GetMemory()->Alloc<char>(sound->info.data_len);
memcpy(sound->data, tempData, sound->info.data_len); memcpy(sound->data, tempData, sound->info.data_len);
} }
else else

View File

@ -8,7 +8,7 @@ namespace IW4
class Actions_LoadedSound final : public AssetLoadingActions class Actions_LoadedSound final : public AssetLoadingActions
{ {
public: public:
explicit Actions_LoadedSound(Zone* zone); explicit Actions_LoadedSound(Zone& zone);
void SetSoundData(MssSound* sound) const; void SetSoundData(MssSound* sound) const;
}; };

View File

@ -4,7 +4,7 @@
using namespace IW4; using namespace IW4;
Actions_XModel::Actions_XModel(Zone* zone) Actions_XModel::Actions_XModel(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -13,7 +13,7 @@ void Actions_XModel::SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSur
{ {
if (modelSurfs) if (modelSurfs)
{ {
lodInfo->modelSurfs = m_zone->GetMemory()->Alloc<XModelSurfs>(); lodInfo->modelSurfs = m_zone.GetMemory()->Alloc<XModelSurfs>();
memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs)); memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs));
} }
} }

View File

@ -8,7 +8,7 @@ namespace IW4
class Actions_XModel final : public AssetLoadingActions class Actions_XModel final : public AssetLoadingActions
{ {
public: public:
explicit Actions_XModel(Zone* zone); explicit Actions_XModel(Zone& zone);
void SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const; void SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const;
}; };

View File

@ -207,8 +207,8 @@ std::unique_ptr<ZoneLoader> ZoneLoaderFactory::CreateLoaderForHeader(ZoneHeader&
zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>());
// Start of the zone content // Start of the zone content
zoneLoader->AddLoadingStep( zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(
std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); std::make_unique<ContentLoader>(*zonePtr), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
return zoneLoader; return zoneLoader;
} }

View File

@ -47,8 +47,9 @@
using namespace IW5; using namespace IW5;
ContentLoader::ContentLoader() ContentLoader::ContentLoader(Zone& zone)
: varXAsset(nullptr), : ContentLoaderBase(zone),
varXAsset(nullptr),
varScriptStringList(nullptr) varScriptStringList(nullptr)
{ {
} }
@ -69,12 +70,12 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart)
LoadXStringArray(true, varScriptStringList->count); LoadXStringArray(true, varScriptStringList->count);
if (varScriptStringList->strings && varScriptStringList->count > 0) if (varScriptStringList->strings && varScriptStringList->count > 0)
m_zone->m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count)); m_zone.m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count));
} }
m_stream->PopBlock(); m_stream->PopBlock();
assert(m_zone->m_script_strings.Count() <= SCR_STRING_MAX + 1); assert(m_zone.m_script_strings.Count() <= SCR_STRING_MAX + 1);
} }
void ContentLoader::LoadXAsset(const bool atStreamStart) const void ContentLoader::LoadXAsset(const bool atStreamStart) const
@ -162,9 +163,8 @@ void ContentLoader::LoadXAssetArray(const bool atStreamStart, const size_t count
} }
} }
void ContentLoader::Load(Zone* zone, IZoneInputStream* stream) void ContentLoader::Load(IZoneInputStream* stream)
{ {
m_zone = zone;
m_stream = stream; m_stream = stream;
m_stream->PushBlock(XFILE_BLOCK_VIRTUAL); m_stream->PushBlock(XFILE_BLOCK_VIRTUAL);

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "Game/IW5/IW5.h" #include "Game/IW5/IW5.h"
#include "Loading/ContentLoaderBase.h" #include "Loading/ContentLoaderBase.h"
#include "Loading/IContentLoadingEntryPoint.h" #include "Loading/IContentLoadingEntryPoint.h"
@ -7,17 +8,18 @@ namespace IW5
{ {
class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint
{ {
XAsset* varXAsset; public:
ScriptStringList* varScriptStringList; explicit ContentLoader(Zone& zone);
void Load(IZoneInputStream* stream) override;
private:
void LoadScriptStringList(bool atStreamStart); void LoadScriptStringList(bool atStreamStart);
void LoadXAsset(bool atStreamStart) const; void LoadXAsset(bool atStreamStart) const;
void LoadXAssetArray(bool atStreamStart, size_t count); void LoadXAssetArray(bool atStreamStart, size_t count);
public: XAsset* varXAsset;
ContentLoader(); ScriptStringList* varScriptStringList;
void Load(Zone* zone, IZoneInputStream* stream) override;
}; };
} // namespace IW5 } // namespace IW5

View File

@ -5,13 +5,13 @@
using namespace IW5; using namespace IW5;
Actions_clipMap_t::Actions_clipMap_t(Zone* zone) Actions_clipMap_t::Actions_clipMap_t(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
void Actions_clipMap_t::ReallocClipInfo(const ClipInfo* clipInfo, clipMap_t* clipMap) const void Actions_clipMap_t::ReallocClipInfo(const ClipInfo* clipInfo, clipMap_t* clipMap) const
{ {
clipMap->pInfo = m_zone->GetMemory()->Alloc<ClipInfo>(); clipMap->pInfo = m_zone.GetMemory()->Alloc<ClipInfo>();
memcpy(clipMap->pInfo, clipInfo, sizeof(ClipInfo)); memcpy(clipMap->pInfo, clipInfo, sizeof(ClipInfo));
} }

View File

@ -8,7 +8,7 @@ namespace IW5
class Actions_clipMap_t final : public AssetLoadingActions class Actions_clipMap_t final : public AssetLoadingActions
{ {
public: public:
explicit Actions_clipMap_t(Zone* zone); explicit Actions_clipMap_t(Zone& zone);
void ReallocClipInfo(const ClipInfo* clipInfo, clipMap_t* clipMap) const; void ReallocClipInfo(const ClipInfo* clipInfo, clipMap_t* clipMap) const;
}; };

View File

@ -5,7 +5,7 @@
using namespace IW5; using namespace IW5;
Actions_GfxImage::Actions_GfxImage(Zone* zone) Actions_GfxImage::Actions_GfxImage(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
{ {
const size_t loadDefSize = offsetof(IW5::GfxImageLoadDef, data) + loadDef->resourceSize; const size_t loadDefSize = offsetof(IW5::GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->AllocRaw(loadDefSize)); image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize); memcpy(image->texture.loadDef, loadDef, loadDefSize);
} }

View File

@ -8,7 +8,7 @@ namespace IW5
class Actions_GfxImage final : public AssetLoadingActions class Actions_GfxImage final : public AssetLoadingActions
{ {
public: public:
explicit Actions_GfxImage(Zone* zone); explicit Actions_GfxImage(Zone& zone);
void OnImageLoaded(GfxImage* image) const; void OnImageLoaded(GfxImage* image) const;
void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const;

View File

@ -4,7 +4,7 @@
using namespace IW5; using namespace IW5;
Actions_LoadedSound::Actions_LoadedSound(Zone* zone) Actions_LoadedSound::Actions_LoadedSound(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -14,7 +14,7 @@ void Actions_LoadedSound::SetSoundData(MssSound* sound) const
if (sound->info.data_len > 0) if (sound->info.data_len > 0)
{ {
char* tempData = sound->data; char* tempData = sound->data;
sound->data = m_zone->GetMemory()->Alloc<char>(sound->info.data_len); sound->data = m_zone.GetMemory()->Alloc<char>(sound->info.data_len);
memcpy(sound->data, tempData, sound->info.data_len); memcpy(sound->data, tempData, sound->info.data_len);
} }
else else

View File

@ -8,7 +8,7 @@ namespace IW5
class Actions_LoadedSound final : public AssetLoadingActions class Actions_LoadedSound final : public AssetLoadingActions
{ {
public: public:
explicit Actions_LoadedSound(Zone* zone); explicit Actions_LoadedSound(Zone& zone);
void SetSoundData(MssSound* sound) const; void SetSoundData(MssSound* sound) const;
}; };

View File

@ -4,7 +4,7 @@
using namespace IW5; using namespace IW5;
Actions_XModel::Actions_XModel(Zone* zone) Actions_XModel::Actions_XModel(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -13,7 +13,7 @@ void Actions_XModel::SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSur
{ {
if (modelSurfs) if (modelSurfs)
{ {
lodInfo->modelSurfs = m_zone->GetMemory()->Alloc<XModelSurfs>(); lodInfo->modelSurfs = m_zone.GetMemory()->Alloc<XModelSurfs>();
memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs)); memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs));
} }
} }

View File

@ -8,7 +8,7 @@ namespace IW5
class Actions_XModel final : public AssetLoadingActions class Actions_XModel final : public AssetLoadingActions
{ {
public: public:
explicit Actions_XModel(Zone* zone); explicit Actions_XModel(Zone& zone);
void SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const; void SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const;
}; };

View File

@ -184,8 +184,8 @@ std::unique_ptr<ZoneLoader> ZoneLoaderFactory::CreateLoaderForHeader(ZoneHeader&
zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>());
// Start of the zone content // Start of the zone content
zoneLoader->AddLoadingStep( zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(
std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); std::make_unique<ContentLoader>(*zonePtr), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
return zoneLoader; return zoneLoader;
} }

View File

@ -39,8 +39,9 @@
using namespace T5; using namespace T5;
ContentLoader::ContentLoader() ContentLoader::ContentLoader(Zone& zone)
: varXAsset(nullptr), : ContentLoaderBase(zone),
varXAsset(nullptr),
varScriptStringList(nullptr) varScriptStringList(nullptr)
{ {
} }
@ -61,12 +62,12 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart)
LoadXStringArray(true, varScriptStringList->count); LoadXStringArray(true, varScriptStringList->count);
if (varScriptStringList->strings && varScriptStringList->count > 0) if (varScriptStringList->strings && varScriptStringList->count > 0)
m_zone->m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count)); m_zone.m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count));
} }
m_stream->PopBlock(); m_stream->PopBlock();
assert(m_zone->m_script_strings.Count() <= SCR_STRING_MAX + 1); assert(m_zone.m_script_strings.Count() <= SCR_STRING_MAX + 1);
} }
void ContentLoader::LoadXAsset(const bool atStreamStart) const void ContentLoader::LoadXAsset(const bool atStreamStart) const
@ -146,9 +147,8 @@ void ContentLoader::LoadXAssetArray(const bool atStreamStart, const size_t count
} }
} }
void ContentLoader::Load(Zone* zone, IZoneInputStream* stream) void ContentLoader::Load(IZoneInputStream* stream)
{ {
m_zone = zone;
m_stream = stream; m_stream = stream;
m_stream->PushBlock(XFILE_BLOCK_VIRTUAL); m_stream->PushBlock(XFILE_BLOCK_VIRTUAL);

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "Game/T5/T5.h" #include "Game/T5/T5.h"
#include "Loading/ContentLoaderBase.h" #include "Loading/ContentLoaderBase.h"
#include "Loading/IContentLoadingEntryPoint.h" #include "Loading/IContentLoadingEntryPoint.h"
@ -7,17 +8,18 @@ namespace T5
{ {
class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint
{ {
XAsset* varXAsset; public:
ScriptStringList* varScriptStringList; explicit ContentLoader(Zone& zone);
void Load(IZoneInputStream* stream) override;
private:
void LoadScriptStringList(bool atStreamStart); void LoadScriptStringList(bool atStreamStart);
void LoadXAsset(bool atStreamStart) const; void LoadXAsset(bool atStreamStart) const;
void LoadXAssetArray(bool atStreamStart, size_t count); void LoadXAssetArray(bool atStreamStart, size_t count);
public: XAsset* varXAsset;
ContentLoader(); ScriptStringList* varScriptStringList;
void Load(Zone* zone, IZoneInputStream* stream) override;
}; };
} // namespace T5 } // namespace T5

View File

@ -5,7 +5,7 @@
using namespace T5; using namespace T5;
Actions_GfxImage::Actions_GfxImage(Zone* zone) Actions_GfxImage::Actions_GfxImage(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
{ {
const size_t loadDefSize = offsetof(GfxImageLoadDef, data) + loadDef->resourceSize; const size_t loadDefSize = offsetof(GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->AllocRaw(loadDefSize)); image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize); memcpy(image->texture.loadDef, loadDef, loadDefSize);
} }

View File

@ -8,7 +8,7 @@ namespace T5
class Actions_GfxImage final : public AssetLoadingActions class Actions_GfxImage final : public AssetLoadingActions
{ {
public: public:
explicit Actions_GfxImage(Zone* zone); explicit Actions_GfxImage(Zone& zone);
void OnImageLoaded(GfxImage* image) const; void OnImageLoaded(GfxImage* image) const;
void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const;

View File

@ -85,8 +85,8 @@ std::unique_ptr<ZoneLoader> ZoneLoaderFactory::CreateLoaderForHeader(ZoneHeader&
zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>());
// Start of the zone content // Start of the zone content
zoneLoader->AddLoadingStep( zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(
std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); std::make_unique<ContentLoader>(*zonePtr), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
return zoneLoader; return zoneLoader;
} }

View File

@ -55,8 +55,9 @@
using namespace T6; using namespace T6;
ContentLoader::ContentLoader() ContentLoader::ContentLoader(Zone& zone)
: varXAsset(nullptr), : ContentLoaderBase(zone),
varXAsset(nullptr),
varScriptStringList(nullptr) varScriptStringList(nullptr)
{ {
} }
@ -77,12 +78,12 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart)
LoadXStringArray(true, varScriptStringList->count); LoadXStringArray(true, varScriptStringList->count);
if (varScriptStringList->strings && varScriptStringList->count > 0) if (varScriptStringList->strings && varScriptStringList->count > 0)
m_zone->m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count)); m_zone.m_script_strings.InitializeForExistingZone(varScriptStringList->strings, static_cast<size_t>(varScriptStringList->count));
} }
m_stream->PopBlock(); m_stream->PopBlock();
assert(m_zone->m_script_strings.Count() <= SCR_STRING_MAX + 1); assert(m_zone.m_script_strings.Count() <= SCR_STRING_MAX + 1);
} }
void ContentLoader::LoadXAsset(const bool atStreamStart) const void ContentLoader::LoadXAsset(const bool atStreamStart) const
@ -175,9 +176,8 @@ void ContentLoader::LoadXAssetArray(const bool atStreamStart, const size_t count
} }
} }
void ContentLoader::Load(Zone* zone, IZoneInputStream* stream) void ContentLoader::Load(IZoneInputStream* stream)
{ {
m_zone = zone;
m_stream = stream; m_stream = stream;
m_stream->PushBlock(XFILE_BLOCK_VIRTUAL); m_stream->PushBlock(XFILE_BLOCK_VIRTUAL);

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "Game/T6/T6.h" #include "Game/T6/T6.h"
#include "Loading/ContentLoaderBase.h" #include "Loading/ContentLoaderBase.h"
#include "Loading/IContentLoadingEntryPoint.h" #include "Loading/IContentLoadingEntryPoint.h"
@ -7,17 +8,18 @@ namespace T6
{ {
class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint
{ {
XAsset* varXAsset; public:
ScriptStringList* varScriptStringList; explicit ContentLoader(Zone& zone);
void Load(IZoneInputStream* stream) override;
private:
void LoadScriptStringList(bool atStreamStart); void LoadScriptStringList(bool atStreamStart);
void LoadXAsset(bool atStreamStart) const; void LoadXAsset(bool atStreamStart) const;
void LoadXAssetArray(bool atStreamStart, size_t count); void LoadXAssetArray(bool atStreamStart, size_t count);
public: XAsset* varXAsset;
ContentLoader(); ScriptStringList* varScriptStringList;
void Load(Zone* zone, IZoneInputStream* stream) override;
}; };
} // namespace T6 } // namespace T6

View File

@ -5,7 +5,7 @@
using namespace T6; using namespace T6;
Actions_GfxImage::Actions_GfxImage(Zone* zone) Actions_GfxImage::Actions_GfxImage(Zone& zone)
: AssetLoadingActions(zone) : AssetLoadingActions(zone)
{ {
} }
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
{ {
const size_t loadDefSize = offsetof(T6::GfxImageLoadDef, data) + loadDef->resourceSize; const size_t loadDefSize = offsetof(T6::GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->AllocRaw(loadDefSize)); image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize); memcpy(image->texture.loadDef, loadDef, loadDefSize);
} }

View File

@ -8,7 +8,7 @@ namespace T6
class Actions_GfxImage final : public AssetLoadingActions class Actions_GfxImage final : public AssetLoadingActions
{ {
public: public:
explicit Actions_GfxImage(Zone* zone); explicit Actions_GfxImage(Zone& zone);
void OnImageLoaded(GfxImage* image) const; void OnImageLoaded(GfxImage* image) const;
void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const;

View File

@ -203,8 +203,8 @@ std::unique_ptr<ZoneLoader> ZoneLoaderFactory::CreateLoaderForHeader(ZoneHeader&
zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>());
// Start of the zone content // Start of the zone content
zoneLoader->AddLoadingStep( zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(
std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); std::make_unique<ContentLoader>(*zonePtr), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK));
if (isSecure) if (isSecure)
{ {

View File

@ -3,10 +3,10 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
AssetLoader::AssetLoader(const asset_type_t assetType, Zone* zone, IZoneInputStream* stream) AssetLoader::AssetLoader(const asset_type_t assetType, Zone& zone, IZoneInputStream* stream)
: ContentLoaderBase(zone, stream), : ContentLoaderBase(zone, stream),
m_asset_type(assetType), varScriptString(nullptr),
varScriptString(nullptr) m_asset_type(assetType)
{ {
} }
@ -16,11 +16,11 @@ XAssetInfoGeneric* AssetLoader::LinkAsset(std::string name,
std::vector<scr_string_t> scriptStrings, std::vector<scr_string_t> scriptStrings,
std::vector<IndirectAssetReference> indirectAssetReferences) const std::vector<IndirectAssetReference> indirectAssetReferences) const
{ {
return m_zone->m_pools->AddAsset( return m_zone.m_pools->AddAsset(
m_asset_type, std::move(name), asset, std::move(dependencies), std::move(scriptStrings), std::move(indirectAssetReferences)); m_asset_type, std::move(name), asset, std::move(dependencies), std::move(scriptStrings), std::move(indirectAssetReferences));
} }
XAssetInfoGeneric* AssetLoader::GetAssetInfo(const std::string& name) const XAssetInfoGeneric* AssetLoader::GetAssetInfo(const std::string& name) const
{ {
return m_zone->m_pools->GetAsset(m_asset_type, name); return m_zone.m_pools->GetAsset(m_asset_type, name);
} }

View File

@ -4,17 +4,12 @@
#include "Pool/XAssetInfo.h" #include "Pool/XAssetInfo.h"
#include "Zone/ZoneTypes.h" #include "Zone/ZoneTypes.h"
#include <unordered_set>
#include <vector> #include <vector>
class AssetLoader : public ContentLoaderBase class AssetLoader : public ContentLoaderBase
{ {
asset_type_t m_asset_type;
protected: protected:
scr_string_t* varScriptString; AssetLoader(asset_type_t assetType, Zone& zone, IZoneInputStream* stream);
AssetLoader(asset_type_t assetType, Zone* zone, IZoneInputStream* stream);
XAssetInfoGeneric* LinkAsset(std::string name, XAssetInfoGeneric* LinkAsset(std::string name,
void* asset, void* asset,
@ -22,5 +17,10 @@ protected:
std::vector<scr_string_t> scriptStrings, std::vector<scr_string_t> scriptStrings,
std::vector<IndirectAssetReference> indirectAssetReferences) const; std::vector<IndirectAssetReference> indirectAssetReferences) const;
_NODISCARD XAssetInfoGeneric* GetAssetInfo(const std::string& name) const; [[nodiscard]] XAssetInfoGeneric* GetAssetInfo(const std::string& name) const;
scr_string_t* varScriptString;
private:
asset_type_t m_asset_type;
}; };

View File

@ -1,6 +1,6 @@
#include "AssetLoadingActions.h" #include "AssetLoadingActions.h"
AssetLoadingActions::AssetLoadingActions(Zone* zone) AssetLoadingActions::AssetLoadingActions(Zone& zone)
: m_zone(zone)
{ {
m_zone = zone;
} }

View File

@ -4,9 +4,9 @@
class AssetLoadingActions class AssetLoadingActions
{ {
protected:
Zone* m_zone;
public: public:
explicit AssetLoadingActions(Zone* zone); explicit AssetLoadingActions(Zone& zone);
protected:
Zone& m_zone;
}; };

View File

@ -3,9 +3,9 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
AssetMarker::AssetMarker(const asset_type_t assetType, Zone* zone) AssetMarker::AssetMarker(const asset_type_t assetType, Zone& zone)
: m_asset_type(assetType), : m_zone(zone),
m_zone(zone) m_asset_type(assetType)
{ {
} }
@ -23,9 +23,9 @@ void AssetMarker::AddDependency(XAssetInfoGeneric* assetInfo)
void AssetMarker::Mark_ScriptString(const scr_string_t scrString) void AssetMarker::Mark_ScriptString(const scr_string_t scrString)
{ {
assert(scrString < m_zone->m_script_strings.Count()); assert(scrString < m_zone.m_script_strings.Count());
if (scrString >= m_zone->m_script_strings.Count()) if (scrString >= m_zone.m_script_strings.Count())
return; return;
m_used_script_strings.emplace(scrString); m_used_script_strings.emplace(scrString);
@ -57,7 +57,7 @@ void AssetMarker::MarkArray_IndirectAssetRef(const asset_type_t type, const char
XAssetInfoGeneric* AssetMarker::GetAssetInfoByName(const std::string& name) const XAssetInfoGeneric* AssetMarker::GetAssetInfoByName(const std::string& name) const
{ {
return m_zone->m_pools->GetAsset(m_asset_type, name); return m_zone.m_pools->GetAsset(m_asset_type, name);
} }
std::vector<XAssetInfoGeneric*> AssetMarker::GetDependencies() const std::vector<XAssetInfoGeneric*> AssetMarker::GetDependencies() const

View File

@ -2,21 +2,19 @@
#include "ContentLoaderBase.h" #include "ContentLoaderBase.h"
#include "Pool/XAssetInfo.h" #include "Pool/XAssetInfo.h"
#include "Utils/ClassUtils.h"
#include "Zone/ZoneTypes.h" #include "Zone/ZoneTypes.h"
#include <unordered_set> #include <unordered_set>
class AssetMarker class AssetMarker
{ {
asset_type_t m_asset_type; public:
[[nodiscard]] std::vector<XAssetInfoGeneric*> GetDependencies() const;
std::unordered_set<XAssetInfoGeneric*> m_dependencies; [[nodiscard]] std::vector<scr_string_t> GetUsedScriptStrings() const;
std::unordered_set<scr_string_t> m_used_script_strings; [[nodiscard]] std::vector<IndirectAssetReference> GetIndirectAssetReferences() const;
std::unordered_set<IndirectAssetReference> m_indirect_asset_references;
protected: protected:
AssetMarker(asset_type_t assetType, Zone* zone); AssetMarker(asset_type_t assetType, Zone& zone);
void AddDependency(XAssetInfoGeneric* assetInfo); void AddDependency(XAssetInfoGeneric* assetInfo);
@ -26,12 +24,14 @@ protected:
void Mark_IndirectAssetRef(asset_type_t type, const char* assetRefName); void Mark_IndirectAssetRef(asset_type_t type, const char* assetRefName);
void MarkArray_IndirectAssetRef(asset_type_t type, const char** assetRefNames, size_t count); void MarkArray_IndirectAssetRef(asset_type_t type, const char** assetRefNames, size_t count);
_NODISCARD XAssetInfoGeneric* GetAssetInfoByName(const std::string& name) const; [[nodiscard]] XAssetInfoGeneric* GetAssetInfoByName(const std::string& name) const;
Zone* m_zone; Zone& m_zone;
public: private:
_NODISCARD std::vector<XAssetInfoGeneric*> GetDependencies() const; asset_type_t m_asset_type;
_NODISCARD std::vector<scr_string_t> GetUsedScriptStrings() const;
_NODISCARD std::vector<IndirectAssetReference> GetIndirectAssetReferences() const; std::unordered_set<XAssetInfoGeneric*> m_dependencies;
std::unordered_set<scr_string_t> m_used_script_strings;
std::unordered_set<IndirectAssetReference> m_indirect_asset_references;
}; };

View File

@ -2,19 +2,18 @@
#include <cassert> #include <cassert>
const void* ContentLoaderBase::PTR_FOLLOWING = reinterpret_cast<void*>(-1); ContentLoaderBase::ContentLoaderBase(Zone& zone)
const void* ContentLoaderBase::PTR_INSERT = reinterpret_cast<void*>(-2);
ContentLoaderBase::ContentLoaderBase()
: varXString(nullptr), : varXString(nullptr),
m_zone(nullptr), m_zone(zone),
m_memory(*zone.GetMemory()),
m_stream(nullptr) m_stream(nullptr)
{ {
} }
ContentLoaderBase::ContentLoaderBase(Zone* zone, IZoneInputStream* stream) ContentLoaderBase::ContentLoaderBase(Zone& zone, IZoneInputStream* stream)
: varXString(nullptr), : varXString(nullptr),
m_zone(zone), m_zone(zone),
m_memory(*zone.GetMemory()),
m_stream(stream) m_stream(stream)
{ {
} }

View File

@ -6,20 +6,22 @@
class ContentLoaderBase class ContentLoaderBase
{ {
protected: protected:
static const void* PTR_FOLLOWING; static constexpr auto PTR_FOLLOWING = reinterpret_cast<void*>(-1);
static const void* PTR_INSERT; static constexpr auto PTR_INSERT = reinterpret_cast<void*>(-2);
const char** varXString; public:
virtual ~ContentLoaderBase() = default;
Zone* m_zone; protected:
IZoneInputStream* m_stream; explicit ContentLoaderBase(Zone& zone);
ContentLoaderBase(Zone& zone, IZoneInputStream* stream);
ContentLoaderBase();
ContentLoaderBase(Zone* zone, IZoneInputStream* stream);
void LoadXString(bool atStreamStart) const; void LoadXString(bool atStreamStart) const;
void LoadXStringArray(bool atStreamStart, size_t count); void LoadXStringArray(bool atStreamStart, size_t count);
public: const char** varXString;
virtual ~ContentLoaderBase() = default;
Zone& m_zone;
MemoryManager& m_memory;
IZoneInputStream* m_stream;
}; };

View File

@ -1,12 +1,16 @@
#pragma once #pragma once
#include "Zone/Stream/IZoneInputStream.h" #include "Zone/Stream/IZoneInputStream.h"
#include "Zone/Zone.h"
class IContentLoadingEntryPoint class IContentLoadingEntryPoint
{ {
public: public:
IContentLoadingEntryPoint() = default;
virtual ~IContentLoadingEntryPoint() = default; virtual ~IContentLoadingEntryPoint() = default;
IContentLoadingEntryPoint(const IContentLoadingEntryPoint& other) = default;
IContentLoadingEntryPoint(IContentLoadingEntryPoint&& other) noexcept = default;
IContentLoadingEntryPoint& operator=(const IContentLoadingEntryPoint& other) = default;
IContentLoadingEntryPoint& operator=(IContentLoadingEntryPoint&& other) noexcept = default;
virtual void Load(Zone* zone, IZoneInputStream* stream) = 0; virtual void Load(IZoneInputStream* stream) = 0;
}; };

View File

@ -19,7 +19,7 @@ void StepLoadZoneContent::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* st
{ {
auto* inputStream = new XBlockInputStream(zoneLoader->m_blocks, stream, m_offset_block_bit_count, m_insert_block); auto* inputStream = new XBlockInputStream(zoneLoader->m_blocks, stream, m_offset_block_bit_count, m_insert_block);
m_content_loader->Load(m_zone, inputStream); m_content_loader->Load(inputStream);
delete inputStream; delete inputStream;
} }