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.cpp | |
| parent | bc20e9c433c1c7bd2a9516a936d1d7ffee1e90f2 (diff) | |
| download | zcatch-6309d7ad56357e3aecbfeb7096b434a03bdc70a8.tar.gz zcatch-6309d7ad56357e3aecbfeb7096b434a03bdc70a8.zip | |
continued with localization
Diffstat (limited to 'src/game/localization.cpp')
| -rw-r--r-- | src/game/localization.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/game/localization.cpp b/src/game/localization.cpp index 58ec539c..110a0f5e 100644 --- a/src/game/localization.cpp +++ b/src/game/localization.cpp @@ -1,5 +1,6 @@ #include "localization.hpp" +#include <base/tl/algorithms.hpp> extern "C" { #include <engine/e_linereader.h> @@ -16,7 +17,6 @@ static unsigned str_hash(const char *str) const char *localize(const char *str) { const char *new_str = localization.find_string(str_hash(str)); - //dbg_msg("", "no localization for '%s'", str); return new_str ? new_str : str; } @@ -86,15 +86,19 @@ bool LOCALIZATIONDATABASE::load(const char *filename) replacement += 3; localization.add_string(line, replacement); } - + current_version++; return true; } const char *LOCALIZATIONDATABASE::find_string(unsigned hash) { - array<STRING>::range r = ::find(strings.all(), hash); + STRING s; + s.hash = hash; + sorted_array<STRING>::range r = ::find_binary(strings.all(), s); if(r.empty()) return 0; return r.front().replacement; } + +LOCALIZATIONDATABASE localization; |