diff options
Diffstat (limited to 'src/game/localization.cpp')
| -rw-r--r-- | src/game/localization.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/game/localization.cpp b/src/game/localization.cpp index cf637eff..202e6ca0 100644 --- a/src/game/localization.cpp +++ b/src/game/localization.cpp @@ -6,24 +6,16 @@ extern "C" { #include <engine/e_linereader.h> } -static unsigned str_hash(const char *str) -{ - unsigned hash = 5381; - for(; *str; str++) - hash = ((hash << 5) + hash) + (*str); /* hash * 33 + c */ - return hash; -} - const char *localize(const char *str) { - const char *new_str = localization.find_string(str_hash(str)); + const char *new_str = localization.find_string(str_quickhash(str)); return new_str ? new_str : str; } LOC_CONSTSTRING::LOC_CONSTSTRING(const char *str) { default_str = str; - hash = str_hash(default_str); + hash = str_quickhash(default_str); version = -1; } @@ -44,7 +36,7 @@ LOCALIZATIONDATABASE::LOCALIZATIONDATABASE() void LOCALIZATIONDATABASE::add_string(const char *org_str, const char *new_str) { STRING s; - s.hash = str_hash(org_str); + s.hash = str_quickhash(org_str); s.replacement = new_str; strings.add(s); } |