diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 5fff17ec1..2d238356a 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: creport.c,v 1.6 2001/02/10 10:40:10 enno Exp $ + * $Id: creport.c,v 1.7 2001/02/11 20:54:00 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -142,8 +142,8 @@ render_message(FILE * f, faction * receiver, message * m) if (m->receiver && receiver!=m->receiver) return; if (m->receiver && get_msglevel(receiver->warnings, receiver->msglevels, m->type) < msg_level(m)) return; - fprintf(f, "MESSAGE %d\n", receiver->index++); - fprintf(f, "%d;type\n", mt->hashkey); + fprintf(f, "MESSAGE %u\n", receiver->index++); + fprintf(f, "%u;type\n", mt->hashkey); if (receiver->options & want(O_DEBUG)) { fprintf(f, "%d;level\n", mt->level); } @@ -225,7 +225,7 @@ cr_output_messages(FILE * F, message * msgs, faction * f) if (get_msglevel(f->warnings, f->msglevels, mt) < m->level) continue; #endif if (mt!=last && (!m->receiver || f==m->receiver)) { - int index = mt->hashkey % CTMAXHASH; + unsigned int index = mt->hashkey % CTMAXHASH; struct crtype * ct = crtypes[index]; last = mt; while (ct && ct->mt->hashkey!=mt->hashkey) ct=ct->nexthash; diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 014a2739b..7b6c8bffb 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: laws.c,v 1.18 2001/02/11 15:16:04 enno Exp $ + * $Id: laws.c,v 1.19 2001/02/11 20:54:01 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -2111,7 +2111,7 @@ reorder_owners(region * r) unit ** up=&r->units, ** useek; building * b=NULL; ship * sh=NULL; - int len = listlen(r->units); + size_t len = listlen(r->units); for (b = r->buildings;b;b=b->next) { unit ** ubegin = up; diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index 0dec1ec9d..0b3802e5d 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: item.c,v 1.8 2001/02/10 14:18:00 enno Exp $ + * $Id: item.c,v 1.9 2001/02/11 20:54:01 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -30,6 +30,7 @@ /* util includes */ #include +#include /* libc includes */ #include @@ -49,9 +50,6 @@ attrib_type at_ltype = { "luxury_type" }; attrib_type at_itype = { "item_type" }; attrib_type at_htype = { "herb_type" }; -extern int hashstring(const char* s); - - static int res_changeaura(unit * u, const resource_type * rtype, int delta) { diff --git a/src/common/kernel/message.c b/src/common/kernel/message.c index 771146984..c3fbb4dea 100644 --- a/src/common/kernel/message.c +++ b/src/common/kernel/message.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: message.c,v 1.5 2001/02/10 19:24:05 enno Exp $ + * $Id: message.c,v 1.6 2001/02/11 20:54:01 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -30,6 +30,8 @@ #include "item.h" #include "building.h" +#include + #include #include #include @@ -49,8 +51,6 @@ typedef struct msg_setting { int level; } msg_setting; -extern int hashstring(const char* s); - /************ Compatibility function *************/ #define MAXSTRLEN (4*DISPLAYSIZE+3) #include "region.h" @@ -195,17 +195,6 @@ mistake(const unit * u, const char *command, const char *comment, int mtype) static messagetype * messagetypes; -extern unsigned int new_hashstring(const char* s); -void -debug_messagetypes(FILE * out) -{ - messagetype * mt; - for (mt=messagetypes;mt;mt=mt->next) { - fprintf(out, "%u->%u;%s\n", mt->hashkey, new_hashstring(mt->name)); - } -} - - messagetype * new_messagetype(const char * name, int level, const char * section) { diff --git a/src/common/kernel/render.c b/src/common/kernel/render.c index 00b6c21ea..1f14a1a2e 100644 --- a/src/common/kernel/render.c +++ b/src/common/kernel/render.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: render.c,v 1.5 2001/02/10 19:24:05 enno Exp $ + * $Id: render.c,v 1.6 2001/02/11 20:56:20 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -357,7 +357,7 @@ render_immediate(const message * m, const char * find, localizer * l) void rendercr(FILE * f, messagetype * mt, const locale * lang) { - fprintf(f, "\"%s\";%d\n", locale_string(lang, mt->name), mt->hashkey); + fprintf(f, "\"%s\";%u\n", locale_string(lang, mt->name), mt->hashkey); } static char * @@ -485,7 +485,7 @@ de_render_casualties(const message * m, const locale * lang) } static const char * -v_travel(const locale * l, void * data) +v_travel(const locale * l, void * data) { int i = (int)data; unused(l); diff --git a/src/common/modules/arena.c b/src/common/modules/arena.c index 82242d88c..525535509 100644 --- a/src/common/modules/arena.c +++ b/src/common/modules/arena.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: arena.c,v 1.3 2001/02/02 08:40:46 enno Exp $ + * $Id: arena.c,v 1.4 2001/02/11 20:54:01 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -44,13 +44,13 @@ #include #include #include +#include /* libc include */ #include #include #include -extern int hashstring(const char* s); /* exports: */ plane * arena = NULL; @@ -59,7 +59,7 @@ plane * arena = NULL; /* local vars */ #define CENTRAL_VOLCANO 1 -static int arena_id = 0; +static unsigned int arena_id = 0; static region * arena_center = NULL; static region * tower_region[6]; static region * start_region[6]; diff --git a/src/common/modules/museum.c b/src/common/modules/museum.c index b745d053a..2e817a7ad 100644 --- a/src/common/modules/museum.c +++ b/src/common/modules/museum.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: museum.c,v 1.2 2001/01/31 07:59:42 enno Exp $ + * $Id: museum.c,v 1.3 2001/02/11 20:54:01 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -223,7 +223,7 @@ init_museum(void) void create_museum(void) { - int museum_id = hashstring("museum"); + unsigned int museum_id = hashstring("museum"); plane *museum = getplanebyid(museum_id); region *r; building *b; diff --git a/src/common/util/goodies.c b/src/common/util/goodies.c index 0c99e082d..ac95d0e85 100644 --- a/src/common/util/goodies.c +++ b/src/common/util/goodies.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: goodies.c,v 1.5 2001/02/10 19:24:05 enno Exp $ + * $Id: goodies.c,v 1.6 2001/02/11 20:54:01 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -58,20 +58,7 @@ intlist_find(int *i_p, int fi) } unsigned int -old_hashstring(const char* s) -{ - int key = 0; - int i = strlen(s); - - while (i) { - --i; - key = ((key >> 31) & 1) ^ (key << 1) ^ s[i]; - } - return key & 0x7fff; -} - -unsigned int -new_hashstring(const char* s) +hashstring(const char* s) { unsigned int key = 0; int i = strlen(s); @@ -82,31 +69,6 @@ new_hashstring(const char* s) return key; } -unsigned int -hashstring(const char* s) -{ -#if RELEASE_VERSION < NEWHASH_VERSION - return old_hashstring(s); -#else - return new_hashstring(s); -#endif -} -/* Standardfunktion aus Sedgewick: Algorithmen in C++ */ - -#define HASH_MAX 100001 -int -hashstring_new(const char* s) -{ - int key = 0; - int i = strlen(s); - - while (i) { - --i; - key = (256 * key + s[i])%HASH_MAX; - } - return key /* & 0x7fffffff */; -} - char * escape_string(char * str, char replace) { diff --git a/src/common/util/language.c b/src/common/util/language.c index 6f116d860..c7815f88d 100644 --- a/src/common/util/language.c +++ b/src/common/util/language.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: language.c,v 1.3 2001/02/10 11:38:29 enno Exp $ + * $Id: language.c,v 1.4 2001/02/11 20:54:01 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -14,6 +14,8 @@ #include #include "language.h" +#include "goodies.h" + #include #include #include @@ -22,7 +24,6 @@ #define SMAXHASH 512 /** importing **/ -extern int hashstring(const char* s); struct locale { struct locale * next; diff --git a/src/eressea-6.opt b/src/eressea-6.opt index edb1ba5df..2e1b13e5a 100644 Binary files a/src/eressea-6.opt and b/src/eressea-6.opt differ