diff --git a/src/modules/autoseed.h b/src/modules/autoseed.h index 71bf68152..254608803 100644 --- a/src/modules/autoseed.h +++ b/src/modules/autoseed.h @@ -16,7 +16,6 @@ extern "C" { #endif - struct region_list; struct newfaction; typedef struct newfaction { diff --git a/src/modules/wormhole.c b/src/modules/wormhole.c index 4553d46b9..e606eab2f 100644 --- a/src/modules/wormhole.c +++ b/src/modules/wormhole.c @@ -27,9 +27,10 @@ /* util includes */ #include -#include -#include #include +#include +#include +#include #include /* libc includes */ @@ -175,9 +176,9 @@ void create_wormholes(void) { #define WORMHOLE_CHANCE 10000 const building_type *bt_wormhole = bt_find("wormhole"); - region_list *rptr, *rlist = NULL; + quicklist *ql, *rlist = 0; region *r = regions; - int i = 0, count = 0; + int qi, i = 0, count = 0; region **match; if (bt_wormhole == NULL) @@ -195,7 +196,7 @@ void create_wormholes(void) } if (r == NULL) break; - add_regionlist(&rlist, r); + ql_push(&rlist, r); ++count; r = r->next; } @@ -204,18 +205,18 @@ void create_wormholes(void) return; match = (region **) malloc(sizeof(region *) * count); - rptr = rlist; - while (i != count) { - match[i++] = rptr->data; - rptr = rptr->next; + + for (ql = rlist,qi = 0; i != count; ql_advance(&ql, &qi, 1)) { + match[i++] = (region *)ql_get(ql, qi); } qsort(match, count, sizeof(region *), cmp_age); - free_regionlist(rlist); + ql_free(rlist); count /= 2; for (i = 0; i != count; ++i) { make_wormhole(bt_wormhole, match[i], match[i + count]); } + free(match); } void register_wormholes(void)