chore: refactor pool allocation and add indirect references

This commit is contained in:
Jan
2024-02-06 23:03:40 +01:00
parent 1e5475e5ce
commit ac0d8a83a0
24 changed files with 1001 additions and 1083 deletions

View File

@ -5,10 +5,12 @@
#include "Zone/ZoneTypes.h"
#include <cstddef>
#include <memory>
#include <string>
#include <vector>
class Zone;
class IndirectAssetReference;
class XAssetInfoGeneric;
class ZoneAssetPools
@ -17,12 +19,7 @@ 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,
std::vector<scr_string_t> usedScriptStrings,
Zone* zone) = 0;
virtual XAssetInfoGeneric* AddAssetToPool(std::unique_ptr<XAssetInfoGeneric> xAssetInfo) = 0;
public:
using iterator = std::vector<XAssetInfoGeneric*>::const_iterator;
@ -34,14 +31,13 @@ public:
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, std::vector<scr_string_t> usedScriptStrings);
XAssetInfoGeneric* AddAsset(std::unique_ptr<XAssetInfoGeneric> xAssetInfo);
XAssetInfoGeneric* AddAsset(asset_type_t type,
std::string name,
void* asset,
std::vector<XAssetInfoGeneric*> dependencies,
std::vector<scr_string_t> usedScriptStrings,
Zone* zone);
std::vector<IndirectAssetReference> indirectAssetReferences);
_NODISCARD virtual XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const = 0;
_NODISCARD virtual asset_type_t GetAssetTypeCount() const = 0;
_NODISCARD virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0;
@ -51,6 +47,6 @@ public:
_NODISCARD size_t GetTotalAssetCount() const;
iterator begin() const;
iterator end() const;
_NODISCARD iterator begin() const;
_NODISCARD iterator end() const;
};