diff --git a/src/game/localization.cpp b/src/game/localization.cpp index 10bf9ea67..7ec913a05 100644 --- a/src/game/localization.cpp +++ b/src/game/localization.cpp @@ -37,11 +37,7 @@ CLocalizationDatabase::CLocalizationDatabase() void CLocalizationDatabase::AddString(const char *pOrgStr, const char *pNewStr, const char *pContext) { - CString s; - s.m_Hash = str_quickhash(pOrgStr); - s.m_ContextHash = str_quickhash(pContext); - s.m_pReplacement = m_StringsHeap.StoreString(*pNewStr ? pNewStr : pOrgStr); - m_Strings.push_back(s); + m_Strings.emplace_back(str_quickhash(pOrgStr), str_quickhash(pContext), m_StringsHeap.StoreString(*pNewStr ? pNewStr : pOrgStr)); } bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, IConsole *pConsole) diff --git a/src/game/localization.h b/src/game/localization.h index 004c76c10..36d1422bb 100644 --- a/src/game/localization.h +++ b/src/game/localization.h @@ -16,6 +16,12 @@ class CLocalizationDatabase unsigned m_ContextHash; const char *m_pReplacement; + CString() {} + CString(unsigned Hash, unsigned ContextHash, const char *pReplacement) : + m_Hash(Hash), m_ContextHash(ContextHash), m_pReplacement(pReplacement) + { + } + bool operator<(const CString &Other) const { return m_Hash < Other.m_Hash || (m_Hash == Other.m_Hash && m_ContextHash < Other.m_ContextHash); } bool operator<=(const CString &Other) const { return m_Hash < Other.m_Hash || (m_Hash == Other.m_Hash && m_ContextHash <= Other.m_ContextHash); } bool operator==(const CString &Other) const { return m_Hash == Other.m_Hash && m_ContextHash == Other.m_ContextHash; }