diff --git a/src/reverse/BasicTypes.cpp b/src/reverse/BasicTypes.cpp index 43d75374..f7b30111 100644 --- a/src/reverse/BasicTypes.cpp +++ b/src/reverse/BasicTypes.cpp @@ -65,6 +65,11 @@ bool CName::operator==(const CName& acRhs) const noexcept return hash == acRhs.hash; } +void CName::Add(const std::string& aName) +{ + RED4ext::CNamePool::Add(aName.c_str()); +} + std::string TweakDBID::ToString() const noexcept { return fmt::format("ToTweakDBID{{ hash = 0x{0:08X}, length = {1:d} }}", name_hash, name_length); diff --git a/src/reverse/BasicTypes.h b/src/reverse/BasicTypes.h index d076852a..da6cadaf 100644 --- a/src/reverse/BasicTypes.h +++ b/src/reverse/BasicTypes.h @@ -92,6 +92,8 @@ struct CName std::string ToString() const noexcept; bool operator==(const CName& acRhs) const noexcept; + + static void Add(const std::string& aName); }; #pragma pack(push, 1) diff --git a/src/scripting/Scripting.cpp b/src/scripting/Scripting.cpp index 58a52268..bdcbb6ac 100644 --- a/src/scripting/Scripting.cpp +++ b/src/scripting/Scripting.cpp @@ -309,7 +309,8 @@ void Scripting::PostInitialize() sol::meta_function::equal_to, &CName::operator==, "hash_lo", &CName::hash_lo, "hash_hi", &CName::hash_hi, - "value", sol::property(&CName::AsString)); + "value", sol::property(&CName::AsString), + "add", &CName::Add); luaGlobal["CName"] = luaVm["CName"]; luaGlobal["ToCName"] = [](sol::table table) -> CName