mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 23:38:09 -05:00
fix: consider asset references when looking for assets of zone
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
#include "ZoneAssetPools.h"
|
||||
|
||||
#include <format>
|
||||
|
||||
ZoneAssetPools::ZoneAssetPools(Zone* zone)
|
||||
: m_zone(zone)
|
||||
{
|
||||
@ -25,6 +27,17 @@ XAssetInfoGeneric* ZoneAssetPools::AddAsset(std::unique_ptr<XAssetInfoGeneric> x
|
||||
return assetInfo;
|
||||
}
|
||||
|
||||
XAssetInfoGeneric* ZoneAssetPools::GetAssetOrAssetReference(const asset_type_t type, const std::string& name) const
|
||||
{
|
||||
auto* result = GetAsset(type, name);
|
||||
|
||||
if (result != nullptr || (!name.empty() && name[0] == ','))
|
||||
return result;
|
||||
|
||||
result = GetAsset(type, std::format(",{}", name));
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t ZoneAssetPools::GetTotalAssetCount() const
|
||||
{
|
||||
return m_assets_in_order.size();
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
std::vector<scr_string_t> usedScriptStrings,
|
||||
std::vector<IndirectAssetReference> indirectAssetReferences);
|
||||
_NODISCARD virtual XAssetInfoGeneric* GetAsset(asset_type_t type, const std::string& name) const = 0;
|
||||
_NODISCARD virtual XAssetInfoGeneric* GetAssetOrAssetReference(asset_type_t type, const std::string& name) const;
|
||||
|
||||
_NODISCARD virtual asset_type_t GetAssetTypeCount() const = 0;
|
||||
_NODISCARD virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user