mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
Make InfoStringDumper scriptstring callback return std::string instead of const std::string& since a reference is not needed
This commit is contained in:
parent
99195232bb
commit
2e61f46544
@ -158,7 +158,7 @@ InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structu
|
||||
}
|
||||
|
||||
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount,
|
||||
std::function<const std::string&(scr_string_t)> scriptStringValueCallback)
|
||||
std::function<std::string(scr_string_t)> scriptStringValueCallback)
|
||||
: InfoStringFromStructConverterBase(structure, std::move(scriptStringValueCallback)),
|
||||
m_fields(fields),
|
||||
m_field_count(fieldCount)
|
||||
|
@ -28,6 +28,6 @@ namespace T6
|
||||
|
||||
public:
|
||||
InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount);
|
||||
InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount, std::function<const std::string&(scr_string_t)> scriptStringValueCallback);
|
||||
InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback);
|
||||
};
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ InfoStringFromStructConverterBase::InfoStringFromStructConverterBase(const void*
|
||||
{
|
||||
}
|
||||
|
||||
InfoStringFromStructConverterBase::InfoStringFromStructConverterBase(const void* structure, std::function<const std::string&(scr_string_t)> scriptStringValueCallback)
|
||||
InfoStringFromStructConverterBase::InfoStringFromStructConverterBase(const void* structure, std::function<std::string(scr_string_t)> scriptStringValueCallback)
|
||||
: m_structure(structure),
|
||||
m_get_scr_string(std::move(scriptStringValueCallback))
|
||||
{
|
||||
@ -132,7 +132,7 @@ InfoString InfoStringFromStructConverterBase::Convert()
|
||||
return std::move(m_info_string);
|
||||
}
|
||||
|
||||
void InfoStringFromStructConverterBase::FillFromString(const std::string& key, size_t offset)
|
||||
void InfoStringFromStructConverterBase::FillFromString(const std::string& key, const size_t offset)
|
||||
{
|
||||
const auto* str = *reinterpret_cast<const char**>(reinterpret_cast<uintptr_t>(m_structure) + offset);
|
||||
|
||||
|
@ -50,7 +50,7 @@ class InfoStringFromStructConverterBase
|
||||
protected:
|
||||
InfoString m_info_string;
|
||||
const void* m_structure;
|
||||
const std::function<const std::string&(scr_string_t)> m_get_scr_string;
|
||||
const std::function<std::string(scr_string_t)> m_get_scr_string;
|
||||
|
||||
void FillFromString(const std::string& key, size_t offset);
|
||||
void FillFromStringBuffer(const std::string& key, size_t offset, size_t bufferSize);
|
||||
@ -67,7 +67,7 @@ protected:
|
||||
|
||||
public:
|
||||
explicit InfoStringFromStructConverterBase(const void* structure);
|
||||
InfoStringFromStructConverterBase(const void* structure, std::function<const std::string&(scr_string_t)> scriptStringValueCallback);
|
||||
InfoStringFromStructConverterBase(const void* structure, std::function<std::string(scr_string_t)> scriptStringValueCallback);
|
||||
virtual ~InfoStringFromStructConverterBase();
|
||||
InfoStringFromStructConverterBase(const InfoStringFromStructConverterBase& other) = delete;
|
||||
InfoStringFromStructConverterBase(InfoStringFromStructConverterBase&& other) noexcept = delete;
|
||||
|
@ -1634,7 +1634,7 @@ void AssetDumperWeapon::DumpAsset(Zone* zone, XAssetInfo<WeaponVariantDef>* asse
|
||||
memset(fullDef, 0, sizeof WeaponFullDef);
|
||||
CopyToFullDef(asset->Asset(), fullDef);
|
||||
|
||||
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, _countof(weapon_fields), [asset](const scr_string_t scrStr) -> const std::string&
|
||||
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, _countof(weapon_fields), [asset](const scr_string_t scrStr)
|
||||
{
|
||||
if (scrStr >= asset->m_script_strings.size())
|
||||
return EMPTY_STRING;
|
||||
|
Loading…
x
Reference in New Issue
Block a user