seen_factions is a quicklist, and the faction_list struct is a thing of the past.

This commit is contained in:
Enno Rehling 2011-02-25 07:27:44 -08:00
parent efca8cee43
commit 14dff6cdfa
5 changed files with 8 additions and 32 deletions

View File

@ -43,6 +43,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/base36.h>
#include <util/parser.h>
#include <util/quicklist.h>
#include <util/rand.h>
#include <util/rng.h>
@ -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) {

View File

@ -27,7 +27,6 @@ struct attrib;
struct unit;
struct faction;
struct region;
struct faction_list;
enum {
ALLIANCE_KICK,

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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