forked from github/server
seen_factions is a quicklist, and the faction_list struct is a thing of the past.
This commit is contained in:
parent
efca8cee43
commit
14dff6cdfa
5 changed files with 8 additions and 32 deletions
|
@ -43,6 +43,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
#include <util/parser.h>
|
#include <util/parser.h>
|
||||||
|
#include <util/quicklist.h>
|
||||||
#include <util/rand.h>
|
#include <util/rand.h>
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ spy_message(int spy, const unit *u, const unit *target)
|
||||||
if (fv && fv!=target->faction) {
|
if (fv && fv!=target->faction) {
|
||||||
/* wahre Partei */
|
/* wahre Partei */
|
||||||
ADDMSG(&u->faction->msgs, msg_message("spyreport_faction", "target faction", target, target->faction));
|
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) {
|
if (spy > 0) {
|
||||||
|
|
|
@ -27,7 +27,6 @@ struct attrib;
|
||||||
struct unit;
|
struct unit;
|
||||||
struct faction;
|
struct faction;
|
||||||
struct region;
|
struct region;
|
||||||
struct faction_list;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ALLIANCE_KICK,
|
ALLIANCE_KICK,
|
||||||
|
|
|
@ -505,19 +505,3 @@ f_get_alliance(const struct faction * f)
|
||||||
}
|
}
|
||||||
return NULL;
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -108,17 +108,11 @@ typedef struct faction {
|
||||||
} * battles;
|
} * battles;
|
||||||
struct item * items; /* items this faction can claim */
|
struct item * items; /* items this faction can claim */
|
||||||
struct seen_region ** seen;
|
struct seen_region ** seen;
|
||||||
struct faction_list * seen_factions;
|
struct quicklist * seen_factions;
|
||||||
} faction;
|
} faction;
|
||||||
|
|
||||||
extern struct faction *factions;
|
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 struct unit * random_unit_in_faction(const struct faction *f);
|
||||||
extern const char * factionname(const struct faction * f);
|
extern const char * factionname(const struct faction * f);
|
||||||
extern struct unit * addplayer(struct region *r, faction * f);
|
extern struct unit * addplayer(struct region *r, faction * f);
|
||||||
|
|
|
@ -900,13 +900,11 @@ stealth_modifier(int seen_mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void transfer_seen(quicklist ** dst, faction_list ** src) {
|
void transfer_seen(quicklist ** dst, quicklist ** src)
|
||||||
while (*src) {
|
{
|
||||||
faction_list * flist = *src;
|
assert(!*dst);
|
||||||
ql_set_insert(dst, flist->data);
|
*dst = *src;
|
||||||
free(flist);
|
*src = NULL;
|
||||||
*src = flist->next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue