1 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2 /* If you are missing that file, acquire a complete release at teeworlds.com. */
3 #ifndef GAME_LOCALIZATION_H
4 #define GAME_LOCALIZATION_H
5 #include <base/tl/string.h>
6 #include <base/tl/sorted_array.h>
8 class CLocalizationDatabase
15 // TODO: do this as an const char * and put everything on a incremental heap
18 bool operator <(const CString
&Other
) const { return m_Hash
< Other
.m_Hash
; }
19 bool operator <=(const CString
&Other
) const { return m_Hash
<= Other
.m_Hash
; }
20 bool operator ==(const CString
&Other
) const { return m_Hash
== Other
.m_Hash
; }
23 sorted_array
<CString
> m_Strings
;
28 CLocalizationDatabase();
30 bool Load(const char *pFilename
, class IStorage
*pStorage
, class IConsole
*pConsole
);
32 int Version() { return m_CurrentVersion
; }
34 void AddString(const char *pOrgStr
, const char *pNewStr
);
35 const char *FindString(unsigned Hash
);
38 extern CLocalizationDatabase g_Localization
;
42 const char *m_pDefaultStr
;
43 const char *m_pCurrentStr
;
47 CLocConstString(const char *pStr
);
50 inline operator const char *()
52 if(m_Version
!= g_Localization
.Version())
59 extern const char *Localize(const char *pStr
);