mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-13 00:08:26 -05:00
Add ZoneScriptString class to store zone script strings
This commit is contained in:
@ -47,7 +47,7 @@ public:
|
||||
|
||||
virtual ~AssetPool() = default;
|
||||
|
||||
virtual XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*>& dependencies) = 0;
|
||||
virtual XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) = 0;
|
||||
|
||||
XAssetInfo<T>* GetAsset(const std::string& name)
|
||||
{
|
||||
|
@ -40,13 +40,14 @@ public:
|
||||
m_asset_lookup.clear();
|
||||
}
|
||||
|
||||
XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*>& dependencies) override
|
||||
XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) override
|
||||
{
|
||||
auto* newInfo = new XAssetInfo<T>();
|
||||
newInfo->m_type = m_type;
|
||||
newInfo->m_name = std::move(name);
|
||||
newInfo->m_zone = zone;
|
||||
newInfo->m_dependencies = std::move(dependencies);
|
||||
newInfo->m_used_script_strings = std::move(usedScriptStrings);
|
||||
|
||||
T* newAsset = new T();
|
||||
memcpy(newAsset, asset, sizeof(T));
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
m_capacity = 0;
|
||||
}
|
||||
|
||||
XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*>& dependencies) override
|
||||
XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) override
|
||||
{
|
||||
if(m_free == nullptr)
|
||||
{
|
||||
@ -99,6 +99,7 @@ public:
|
||||
poolSlot->m_info->m_ptr = &poolSlot->m_entry;
|
||||
poolSlot->m_info->m_zone = zone;
|
||||
poolSlot->m_info->m_dependencies = std::move(dependencies);
|
||||
poolSlot->m_info->m_used_script_strings = std::move(usedScriptStrings);
|
||||
|
||||
m_asset_lookup[poolSlot->m_info->m_name] = poolSlot->m_info;
|
||||
|
||||
|
@ -13,6 +13,7 @@ public:
|
||||
std::string m_name;
|
||||
Zone* m_zone;
|
||||
std::vector<XAssetInfoGeneric*> m_dependencies;
|
||||
std::vector<scr_string_t> m_used_script_strings;
|
||||
void* m_ptr;
|
||||
};
|
||||
|
||||
|
@ -5,10 +5,15 @@ ZoneAssetPools::ZoneAssetPools(Zone* zone)
|
||||
{
|
||||
}
|
||||
|
||||
XAssetInfoGeneric* ZoneAssetPools::AddAsset(const asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*>& dependencies)
|
||||
XAssetInfoGeneric* ZoneAssetPools::AddAsset(const asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings)
|
||||
{
|
||||
auto* assetInfo = AddAssetToPool(type, std::move(name), asset, dependencies);
|
||||
if(assetInfo)
|
||||
return AddAsset(type, std::move(name), asset, std::move(dependencies), std::move(usedScriptStrings), m_zone);
|
||||
}
|
||||
|
||||
XAssetInfoGeneric* ZoneAssetPools::AddAsset(const asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone)
|
||||
{
|
||||
auto* assetInfo = AddAssetToPool(type, std::move(name), asset, std::move(dependencies), std::move(usedScriptStrings), zone);
|
||||
if (assetInfo)
|
||||
{
|
||||
m_assets_in_order.push_back(assetInfo);
|
||||
}
|
||||
|
@ -17,17 +17,23 @@ protected:
|
||||
Zone* m_zone;
|
||||
std::vector<XAssetInfoGeneric*> m_assets_in_order;
|
||||
|
||||
virtual XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*>& dependencies) = 0;
|
||||
virtual XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings,
|
||||
Zone* zone) = 0;
|
||||
|
||||
public:
|
||||
using iterator = std::vector<XAssetInfoGeneric*>::const_iterator;
|
||||
|
||||
explicit ZoneAssetPools(Zone* zone);
|
||||
virtual ~ZoneAssetPools() = default;
|
||||
ZoneAssetPools(const ZoneAssetPools& other) = delete;
|
||||
ZoneAssetPools(ZoneAssetPools&& other) noexcept = default;
|
||||
ZoneAssetPools& operator=(const ZoneAssetPools& other) = delete;
|
||||
ZoneAssetPools& operator=(ZoneAssetPools&& other) noexcept = default;
|
||||
|
||||
XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*>& dependencies);
|
||||
virtual XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const = 0;
|
||||
virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0;
|
||||
XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings);
|
||||
XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone);
|
||||
_NODISCARD virtual XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const = 0;
|
||||
_NODISCARD virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0;
|
||||
|
||||
virtual void InitPoolStatic(asset_type_t type, size_t capacity) = 0;
|
||||
virtual void InitPoolDynamic(asset_type_t type) = 0;
|
||||
|
Reference in New Issue
Block a user