about summary refs log tree commit diff
path: root/src/game/localization.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2009-06-15 13:01:04 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2009-06-15 13:01:04 +0000
commit8bd49fe30b8663a27e1103f149f6f836866bbfc8 (patch)
tree4243fc55ca2b3a00d765cc4754c8732d2fc422e1 /src/game/localization.cpp
parentf817cb231999e51d6721d2b2a3c95d985b08d836 (diff)
downloadzcatch-8bd49fe30b8663a27e1103f149f6f836866bbfc8.tar.gz
zcatch-8bd49fe30b8663a27e1103f149f6f836866bbfc8.zip
some clean up. fixed double server side record messages
Diffstat (limited to 'src/game/localization.cpp')
-rw-r--r--src/game/localization.cpp14
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);
 }