ZoneLoading: Properly link assets as dependencies instead of only saving the name of the dependency

This commit is contained in:
Jan
2020-02-18 13:16:39 +01:00
parent 246d74992c
commit 992e9cea30
16 changed files with 159 additions and 61 deletions

View File

@ -2,6 +2,7 @@
#include "GlobalAssetPool.h"
#include "AssetPool.h"
#include "XAssetInfo.h"
#include <cstring>
@ -25,9 +26,10 @@ class AssetPoolStatic final : public AssetPool<T>
AssetPoolEntry* m_pool;
XAssetInfo<T>* m_info_pool;
size_t m_capacity;
asset_type_t m_type;
public:
AssetPoolStatic(const size_t capacity, const int priority)
AssetPoolStatic(const size_t capacity, const int priority, asset_type_t type)
{
m_capacity = capacity;
@ -78,7 +80,7 @@ public:
m_capacity = 0;
}
XAssetInfo<T>* AddAsset(std::string name, T* asset, std::vector<std::string>& scriptStrings, std::vector<XAssetDependency>& dependencies) override
XAssetInfo<T>* AddAsset(std::string name, T* asset, std::vector<std::string>& scriptStrings, std::vector<XAssetInfoGeneric*>& dependencies) override
{
if(m_free == nullptr)
{
@ -90,8 +92,9 @@ public:
memcpy(&poolSlot->m_entry, asset, sizeof(T));
poolSlot->m_info->m_type = m_type;
poolSlot->m_info->m_name = std::move(name);
poolSlot->m_info->m_asset = &poolSlot->m_entry;
poolSlot->m_info->m_ptr = &poolSlot->m_entry;
poolSlot->m_info->m_script_strings = std::move(scriptStrings);
poolSlot->m_info->m_dependencies = std::move(dependencies);