chore: use const reference for assetName in GetAsset methods

This commit is contained in:
Jan
2024-03-30 17:19:32 +01:00
parent d26fda2e92
commit e7a9e4b528
15 changed files with 19 additions and 19 deletions

View File

@ -169,7 +169,7 @@ XAssetInfoGeneric* GameAssetPoolIW3::AddAssetToPool(std::unique_ptr<XAssetInfoGe
#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) \
case assetType: \

View File

@ -52,7 +52,7 @@ public:
void InitPoolStatic(asset_type_t type, size_t capacity) 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);
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;

View File

@ -200,13 +200,13 @@ XAssetInfoGeneric* GameAssetPoolIW4::AddAssetToPool(std::unique_ptr<XAssetInfoGe
#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) \
case assetType: \
{ \
if ((poolName) != nullptr) \
return (poolName)->GetAsset(std::move(name)); \
return (poolName)->GetAsset(name); \
break; \
}

View File

@ -60,7 +60,7 @@ public:
void InitPoolStatic(asset_type_t type, size_t capacity) 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);
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;

View File

@ -253,7 +253,7 @@ XAssetInfoGeneric* GameAssetPoolIW5::AddAssetToPool(std::unique_ptr<XAssetInfoGe
#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) \
case assetType: \

View File

@ -64,7 +64,7 @@ public:
void InitPoolStatic(asset_type_t type, size_t capacity) 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);
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;

View File

@ -193,7 +193,7 @@ XAssetInfoGeneric* GameAssetPoolT5::AddAssetToPool(std::unique_ptr<XAssetInfoGen
#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) \
case assetType: \

View File

@ -56,7 +56,7 @@ public:
void InitPoolStatic(asset_type_t type, size_t capacity) 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);
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;

View File

@ -294,13 +294,13 @@ XAssetInfoGeneric* GameAssetPoolT6::AddAssetToPool(std::unique_ptr<XAssetInfoGen
#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) \
case assetType: \
{ \
if ((poolName) != nullptr) \
return (poolName)->GetAsset(std::move(name)); \
return (poolName)->GetAsset(name); \
break; \
}

View File

@ -72,7 +72,7 @@ public:
void InitPoolStatic(asset_type_t type, size_t capacity) 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);
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;

View File

@ -38,7 +38,7 @@ public:
std::vector<XAssetInfoGeneric*> dependencies,
std::vector<scr_string_t> usedScriptStrings,
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 const char* GetAssetTypeName(asset_type_t assetType) const = 0;