From 8bd49fe30b8663a27e1103f149f6f836866bbfc8 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Mon, 15 Jun 2009 13:01:04 +0000 Subject: some clean up. fixed double server side record messages --- src/game/localization.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/game/localization.cpp') 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 } -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); } -- cgit 1.4.1