mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
chore: use const reference for assetName in GetAsset methods
This commit is contained in:
parent
d26fda2e92
commit
e7a9e4b528
@ -169,7 +169,7 @@ XAssetInfoGeneric* GameAssetPoolIW3::AddAssetToPool(std::unique_ptr<XAssetInfoGe
|
|||||||
#undef CASE_ADD_TO_POOL
|
#undef CASE_ADD_TO_POOL
|
||||||
}
|
}
|
||||||
|
|
||||||
XAssetInfoGeneric* GameAssetPoolIW3::GetAsset(const asset_type_t type, std::string name) const
|
XAssetInfoGeneric* GameAssetPoolIW3::GetAsset(const asset_type_t type, const std::string& name) const
|
||||||
{
|
{
|
||||||
#define CASE_GET_ASSET(assetType, poolName) \
|
#define CASE_GET_ASSET(assetType, poolName) \
|
||||||
case assetType: \
|
case assetType: \
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
||||||
void InitPoolDynamic(asset_type_t type) override;
|
void InitPoolDynamic(asset_type_t type) override;
|
||||||
|
|
||||||
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
|
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, const std::string& name) const override;
|
||||||
|
|
||||||
static const char* AssetTypeNameByType(asset_type_t assetType);
|
static const char* AssetTypeNameByType(asset_type_t assetType);
|
||||||
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
|
@ -200,13 +200,13 @@ XAssetInfoGeneric* GameAssetPoolIW4::AddAssetToPool(std::unique_ptr<XAssetInfoGe
|
|||||||
#undef CASE_ADD_TO_POOL
|
#undef CASE_ADD_TO_POOL
|
||||||
}
|
}
|
||||||
|
|
||||||
XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, std::string name) const
|
XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, const std::string& name) const
|
||||||
{
|
{
|
||||||
#define CASE_GET_ASSET(assetType, poolName) \
|
#define CASE_GET_ASSET(assetType, poolName) \
|
||||||
case assetType: \
|
case assetType: \
|
||||||
{ \
|
{ \
|
||||||
if ((poolName) != nullptr) \
|
if ((poolName) != nullptr) \
|
||||||
return (poolName)->GetAsset(std::move(name)); \
|
return (poolName)->GetAsset(name); \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
||||||
void InitPoolDynamic(asset_type_t type) override;
|
void InitPoolDynamic(asset_type_t type) override;
|
||||||
|
|
||||||
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
|
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, const std::string& name) const override;
|
||||||
|
|
||||||
static const char* AssetTypeNameByType(asset_type_t assetType);
|
static const char* AssetTypeNameByType(asset_type_t assetType);
|
||||||
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
|
@ -253,7 +253,7 @@ XAssetInfoGeneric* GameAssetPoolIW5::AddAssetToPool(std::unique_ptr<XAssetInfoGe
|
|||||||
#undef CASE_ADD_TO_POOL
|
#undef CASE_ADD_TO_POOL
|
||||||
}
|
}
|
||||||
|
|
||||||
XAssetInfoGeneric* GameAssetPoolIW5::GetAsset(const asset_type_t type, std::string name) const
|
XAssetInfoGeneric* GameAssetPoolIW5::GetAsset(const asset_type_t type, const std::string& name) const
|
||||||
{
|
{
|
||||||
#define CASE_GET_ASSET(assetType, poolName) \
|
#define CASE_GET_ASSET(assetType, poolName) \
|
||||||
case assetType: \
|
case assetType: \
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
||||||
void InitPoolDynamic(asset_type_t type) override;
|
void InitPoolDynamic(asset_type_t type) override;
|
||||||
|
|
||||||
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
|
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, const std::string& name) const override;
|
||||||
|
|
||||||
static const char* AssetTypeNameByType(asset_type_t assetType);
|
static const char* AssetTypeNameByType(asset_type_t assetType);
|
||||||
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
|
@ -193,7 +193,7 @@ XAssetInfoGeneric* GameAssetPoolT5::AddAssetToPool(std::unique_ptr<XAssetInfoGen
|
|||||||
#undef CASE_ADD_TO_POOL
|
#undef CASE_ADD_TO_POOL
|
||||||
}
|
}
|
||||||
|
|
||||||
XAssetInfoGeneric* GameAssetPoolT5::GetAsset(const asset_type_t type, std::string name) const
|
XAssetInfoGeneric* GameAssetPoolT5::GetAsset(const asset_type_t type, const std::string& name) const
|
||||||
{
|
{
|
||||||
#define CASE_GET_ASSET(assetType, poolName) \
|
#define CASE_GET_ASSET(assetType, poolName) \
|
||||||
case assetType: \
|
case assetType: \
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
||||||
void InitPoolDynamic(asset_type_t type) override;
|
void InitPoolDynamic(asset_type_t type) override;
|
||||||
|
|
||||||
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
|
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, const std::string& name) const override;
|
||||||
|
|
||||||
static const char* AssetTypeNameByType(asset_type_t assetType);
|
static const char* AssetTypeNameByType(asset_type_t assetType);
|
||||||
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
|
@ -294,13 +294,13 @@ XAssetInfoGeneric* GameAssetPoolT6::AddAssetToPool(std::unique_ptr<XAssetInfoGen
|
|||||||
#undef CASE_ADD_TO_POOL
|
#undef CASE_ADD_TO_POOL
|
||||||
}
|
}
|
||||||
|
|
||||||
XAssetInfoGeneric* GameAssetPoolT6::GetAsset(const asset_type_t type, std::string name) const
|
XAssetInfoGeneric* GameAssetPoolT6::GetAsset(const asset_type_t type, const std::string& name) const
|
||||||
{
|
{
|
||||||
#define CASE_GET_ASSET(assetType, poolName) \
|
#define CASE_GET_ASSET(assetType, poolName) \
|
||||||
case assetType: \
|
case assetType: \
|
||||||
{ \
|
{ \
|
||||||
if ((poolName) != nullptr) \
|
if ((poolName) != nullptr) \
|
||||||
return (poolName)->GetAsset(std::move(name)); \
|
return (poolName)->GetAsset(name); \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
void InitPoolStatic(asset_type_t type, size_t capacity) override;
|
||||||
void InitPoolDynamic(asset_type_t type) override;
|
void InitPoolDynamic(asset_type_t type) override;
|
||||||
|
|
||||||
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
|
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, const std::string& name) const override;
|
||||||
|
|
||||||
static const char* AssetTypeNameByType(asset_type_t assetType);
|
static const char* AssetTypeNameByType(asset_type_t assetType);
|
||||||
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
std::vector<XAssetInfoGeneric*> dependencies,
|
std::vector<XAssetInfoGeneric*> dependencies,
|
||||||
std::vector<scr_string_t> usedScriptStrings,
|
std::vector<scr_string_t> usedScriptStrings,
|
||||||
std::vector<IndirectAssetReference> indirectAssetReferences);
|
std::vector<IndirectAssetReference> indirectAssetReferences);
|
||||||
_NODISCARD virtual XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const = 0;
|
_NODISCARD virtual XAssetInfoGeneric* GetAsset(asset_type_t type, const std::string& name) const = 0;
|
||||||
_NODISCARD virtual asset_type_t GetAssetTypeCount() const = 0;
|
_NODISCARD virtual asset_type_t GetAssetTypeCount() const = 0;
|
||||||
_NODISCARD virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0;
|
_NODISCARD virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ XAssetInfoGeneric* AssetLoader::LinkAsset(std::string name,
|
|||||||
m_asset_type, std::move(name), asset, std::move(dependencies), std::move(scriptStrings), std::move(indirectAssetReferences));
|
m_asset_type, std::move(name), asset, std::move(dependencies), std::move(scriptStrings), std::move(indirectAssetReferences));
|
||||||
}
|
}
|
||||||
|
|
||||||
XAssetInfoGeneric* AssetLoader::GetAssetInfo(std::string name) const
|
XAssetInfoGeneric* AssetLoader::GetAssetInfo(const std::string& name) const
|
||||||
{
|
{
|
||||||
return m_zone->m_pools->GetAsset(m_asset_type, std::move(name));
|
return m_zone->m_pools->GetAsset(m_asset_type, name);
|
||||||
}
|
}
|
||||||
|
@ -22,5 +22,5 @@ protected:
|
|||||||
std::vector<scr_string_t> scriptStrings,
|
std::vector<scr_string_t> scriptStrings,
|
||||||
std::vector<IndirectAssetReference> indirectAssetReferences) const;
|
std::vector<IndirectAssetReference> indirectAssetReferences) const;
|
||||||
|
|
||||||
_NODISCARD XAssetInfoGeneric* GetAssetInfo(std::string name) const;
|
_NODISCARD XAssetInfoGeneric* GetAssetInfo(const std::string& name) const;
|
||||||
};
|
};
|
||||||
|
@ -55,9 +55,9 @@ void AssetMarker::MarkArray_IndirectAssetRef(const asset_type_t type, const char
|
|||||||
Mark_IndirectAssetRef(type, assetRefNames[index]);
|
Mark_IndirectAssetRef(type, assetRefNames[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
XAssetInfoGeneric* AssetMarker::GetAssetInfoByName(std::string name) const
|
XAssetInfoGeneric* AssetMarker::GetAssetInfoByName(const std::string& name) const
|
||||||
{
|
{
|
||||||
return m_zone->m_pools->GetAsset(m_asset_type, std::move(name));
|
return m_zone->m_pools->GetAsset(m_asset_type, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<XAssetInfoGeneric*> AssetMarker::GetDependencies() const
|
std::vector<XAssetInfoGeneric*> AssetMarker::GetDependencies() const
|
||||||
|
@ -26,7 +26,7 @@ protected:
|
|||||||
void Mark_IndirectAssetRef(asset_type_t type, const char* assetRefName);
|
void Mark_IndirectAssetRef(asset_type_t type, const char* assetRefName);
|
||||||
void MarkArray_IndirectAssetRef(asset_type_t type, const char** assetRefNames, size_t count);
|
void MarkArray_IndirectAssetRef(asset_type_t type, const char** assetRefNames, size_t count);
|
||||||
|
|
||||||
_NODISCARD XAssetInfoGeneric* GetAssetInfoByName(std::string name) const;
|
_NODISCARD XAssetInfoGeneric* GetAssetInfoByName(const std::string& name) const;
|
||||||
|
|
||||||
Zone* m_zone;
|
Zone* m_zone;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user