Fix string symbol definitions.

This commit is contained in:
Skyth 2024-11-27 11:20:18 +03:00
parent 685fe7285d
commit 888ca67d79
2 changed files with 5 additions and 26 deletions

View file

@ -4,34 +4,23 @@
namespace Hedgehog::Base
{
struct SSymbolNode
{
xpointer<SSymbolNode> pPrev;
xpointer<SSymbolNode> pNext;
be<uint32_t> Hash;
const char* GetValue() const;
};
class CSharedString;
class CStringSymbol
{
public:
xpointer<SSymbolNode> m_pSymbolNode;
be<uint32_t> m_Index;
CStringSymbol();
CStringSymbol(const char* in_pName);
CStringSymbol(const CSharedString& in_rName);
const char* GetValue() const;
bool operator==(const CStringSymbol& in_rOther) const;
bool operator!=(const CStringSymbol& in_rOther) const;
bool operator<(const CStringSymbol& in_rOther) const;
};
SWA_ASSERT_OFFSETOF(CStringSymbol, m_pSymbolNode, 0);
SWA_ASSERT_OFFSETOF(CStringSymbol, m_Index, 0);
SWA_ASSERT_SIZEOF(CStringSymbol, 4);
}

View file

@ -1,10 +1,5 @@
namespace Hedgehog::Base
{
inline const char* SSymbolNode::GetValue() const
{
return reinterpret_cast<const char*>(this) + sizeof(SSymbolNode);
}
inline CStringSymbol::CStringSymbol()
{
}
@ -19,23 +14,18 @@ namespace Hedgehog::Base
GuestToHostFunction<void>(sub_82E013B0, this, &in_rName);
}
inline const char* CStringSymbol::GetValue() const
{
return m_pSymbolNode->GetValue();
}
inline bool CStringSymbol::operator==(const CStringSymbol& in_rOther) const
{
return m_pSymbolNode == in_rOther.m_pSymbolNode;
return m_Index == in_rOther.m_Index;
}
inline bool CStringSymbol::operator!=(const CStringSymbol& in_rOther) const
{
return m_pSymbolNode != in_rOther.m_pSymbolNode;
return m_Index != in_rOther.m_Index;
}
inline bool CStringSymbol::operator<(const CStringSymbol& in_rOther) const
{
return m_pSymbolNode < in_rOther.m_pSymbolNode;
return m_Index < in_rOther.m_Index;
}
}