diff --git a/src/eressea.c b/src/eressea.c index 703334993..d08a60df6 100755 --- a/src/eressea.c +++ b/src/eressea.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,7 @@ void game_done(void) calendar_cleanup(); #endif free_functions(); + free_curses(); kernel_done(); } diff --git a/src/kernel/curse.c b/src/kernel/curse.c index 828552a3a..fe32ef1e0 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -293,11 +293,12 @@ attrib_type at_curse = { #include #include -static quicklist *cursetypes[256]; +#define MAXCTHASH 128 +static quicklist *cursetypes[MAXCTHASH]; void ct_register(const curse_type * ct) { - unsigned int hash = tolower(ct->cname[0]); + unsigned int hash = tolower(ct->cname[0]) & 0xFF; quicklist **ctlp = cursetypes + hash; ql_set_insert(ctlp, (void *)ct); @@ -818,3 +819,10 @@ double destr_curse(curse * c, int cast_level, double force) } return force; } + +void free_curses(void) { + int i; + for (i = 0; i != MAXCTHASH; ++i) { + ql_free(cursetypes[i]); + } +} \ No newline at end of file diff --git a/src/kernel/curse.h b/src/kernel/curse.h index 80ce3109d..143e73d27 100644 --- a/src/kernel/curse.h +++ b/src/kernel/curse.h @@ -214,6 +214,8 @@ extern "C" { int duration; /* Dauer der Verzauberung. Wird jede Runde vermindert */ } curse; + void free_curses(void); /* de-register all curse-types */ + extern struct attrib_type at_curse; void curse_write(const struct attrib *a, const void *owner, struct storage *store);