diff --git a/src/gamecode/spy.c b/src/gamecode/spy.c index 164c3b2b1..42747dfba 100644 --- a/src/gamecode/spy.c +++ b/src/gamecode/spy.c @@ -43,6 +43,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include #include @@ -73,7 +74,7 @@ spy_message(int spy, const unit *u, const unit *target) if (fv && fv!=target->faction) { /* wahre Partei */ ADDMSG(&u->faction->msgs, msg_message("spyreport_faction", "target faction", target, target->faction)); - flist_add(&u->faction->seen_factions, target->faction); + ql_set_insert(&u->faction->seen_factions, target->faction); } } if (spy > 0) { diff --git a/src/kernel/alliance.h b/src/kernel/alliance.h index e384b0f8f..026bd0c11 100644 --- a/src/kernel/alliance.h +++ b/src/kernel/alliance.h @@ -27,7 +27,6 @@ struct attrib; struct unit; struct faction; struct region; -struct faction_list; enum { ALLIANCE_KICK, diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 44873ac24..f5ac32f3c 100644 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -505,19 +505,3 @@ f_get_alliance(const struct faction * f) } return NULL; } - -void -flist_add(faction_list ** flist, faction * sf) -{ - faction_list ** fnew = flist; - while (*fnew && (*fnew)->data->no < sf->no) { - fnew =&(*fnew)->next; - } - if ((*fnew==NULL) || (*fnew)->data!=sf) { - faction_list * finsert = malloc(sizeof(faction_list)); - finsert->next = *fnew; - *fnew = finsert; - finsert->data = sf; - } -} - diff --git a/src/kernel/faction.h b/src/kernel/faction.h index 198af7d88..0e3617e34 100644 --- a/src/kernel/faction.h +++ b/src/kernel/faction.h @@ -108,17 +108,11 @@ typedef struct faction { } * battles; struct item * items; /* items this faction can claim */ struct seen_region ** seen; - struct faction_list * seen_factions; + struct quicklist * seen_factions; } faction; extern struct faction *factions; -typedef struct faction_list { - struct faction_list * next; - struct faction * data; -} faction_list; - -void flist_add(struct faction_list ** flist, struct faction * sf); extern const struct unit * random_unit_in_faction(const struct faction *f); extern const char * factionname(const struct faction * f); extern struct unit * addplayer(struct region *r, faction * f); diff --git a/src/kernel/reports.c b/src/kernel/reports.c index 616c69d1e..8ba41875b 100644 --- a/src/kernel/reports.c +++ b/src/kernel/reports.c @@ -900,13 +900,11 @@ stealth_modifier(int seen_mode) } } -void transfer_seen(quicklist ** dst, faction_list ** src) { - while (*src) { - faction_list * flist = *src; - ql_set_insert(dst, flist->data); - free(flist); - *src = flist->next; - } +void transfer_seen(quicklist ** dst, quicklist ** src) +{ + assert(!*dst); + *dst = *src; + *src = NULL; } static void