2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-07-09 04:31:49 +00:00

Rename ZoneLoader and ZoneWriter components to ZoneLoading and ZoneWriting to make a difference between the executive class and the component class

This commit is contained in:
Jan
2019-09-24 22:35:11 +02:00
parent 0d8432d4f7
commit 42af6df5d8
86 changed files with 22 additions and 13 deletions

View File

@ -0,0 +1,53 @@
#include "AssetLoader.h"
AssetLoader::AssetLoader(const asset_type_t assetType, IZoneScriptStringProvider* scriptStringProvider, Zone* zone, IZoneInputStream* stream)
{
m_asset_type = assetType;
m_script_string_provider = scriptStringProvider;
m_zone = zone;
m_stream = stream;
}
void AssetLoader::AddDependency(const asset_type_t type, std::string& name)
{
for(auto& existingDependency : m_dependencies)
{
if(existingDependency.m_type == type
&& existingDependency.m_name == name)
{
return;
}
}
XAssetDependency dependency;
dependency.m_type = type;
dependency.m_name = name;
m_dependencies.push_back(dependency);
}
scr_string_t AssetLoader::UseScriptString(const scr_string_t scrString)
{
std::string& scrStringValue = m_script_string_provider->GetZoneScriptString(scrString);
scr_string_t scriptStringIndex = 0;
for(auto& existingScriptString : m_used_script_strings)
{
if(existingScriptString == scrStringValue)
{
return scriptStringIndex;
}
scriptStringIndex++;
}
scriptStringIndex = static_cast<scr_string_t>(m_used_script_strings.size());
m_used_script_strings.push_back(scrStringValue);
return scriptStringIndex;
}
void* AssetLoader::LinkAsset(std::string name, void* asset)
{
return m_zone->GetPools()->AddAsset(m_asset_type, std::move(name), asset, m_used_script_strings, m_dependencies);
}