diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2009-06-15 06:45:44 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2009-06-15 06:45:44 +0000 |
| commit | 6309d7ad56357e3aecbfeb7096b434a03bdc70a8 (patch) | |
| tree | 1bf4e300ee2cd13e855c68a6e2160cbc98a06abb /src/game/localization.hpp | |
| parent | bc20e9c433c1c7bd2a9516a936d1d7ffee1e90f2 (diff) | |
| download | zcatch-6309d7ad56357e3aecbfeb7096b434a03bdc70a8.tar.gz zcatch-6309d7ad56357e3aecbfeb7096b434a03bdc70a8.zip | |
continued with localization
Diffstat (limited to 'src/game/localization.hpp')
| -rw-r--r-- | src/game/localization.hpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/game/localization.hpp b/src/game/localization.hpp index de6849d4..3f79d687 100644 --- a/src/game/localization.hpp +++ b/src/game/localization.hpp @@ -1,4 +1,5 @@ -#include <base/tl/array.hpp> +#include <base/tl/string.hpp> +#include <base/tl/sorted_array.hpp> class LOCALIZATIONDATABASE { @@ -6,13 +7,16 @@ class LOCALIZATIONDATABASE { public: unsigned hash; - string replacement; - - bool operator ==(unsigned h) const { return hash == h; } + // TODO: do this as an const char * and put everything on a incremental heap + string replacement; + + bool operator <(const STRING &other) const { return hash < other.hash; } + bool operator <=(const STRING &other) const { return hash <= other.hash; } + bool operator ==(const STRING &other) const { return hash == other.hash; } }; - array<STRING> strings; + sorted_array<STRING> strings; int current_version; public: @@ -26,8 +30,7 @@ public: const char *find_string(unsigned hash); }; -static LOCALIZATIONDATABASE localization; - +extern LOCALIZATIONDATABASE localization; class LOC_CONSTSTRING { @@ -46,3 +49,6 @@ public: return current_str; } }; + + +extern const char *localize(const char *str); |