forked from github/server
Merge pull request #580 from ennorehling/smart-interval
SMART_INTERVALS is no longer a define, but official
This commit is contained in:
commit
a06f73c086
|
@ -509,7 +509,6 @@ void renumber_faction(faction * f, int no)
|
|||
fset(f, FFL_NEWID);
|
||||
}
|
||||
|
||||
#ifdef SMART_INTERVALS
|
||||
void update_interval(struct faction *f, struct region *r)
|
||||
{
|
||||
if (r == NULL || f == NULL)
|
||||
|
@ -521,7 +520,6 @@ void update_interval(struct faction *f, struct region *r)
|
|||
f->last = r;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *faction_getname(const faction * self)
|
||||
{
|
||||
|
|
|
@ -33,9 +33,6 @@ extern "C" {
|
|||
struct gamedata;
|
||||
|
||||
extern struct attrib_type at_maxmagicians;
|
||||
/* SMART_INTERVALS: define to speed up finding the interval of regions that a
|
||||
faction is in. defining this speeds up the turn by 30-40% */
|
||||
#define SMART_INTERVALS
|
||||
|
||||
/* faction flags */
|
||||
#define FFL_NEWID (1<<0) /* Die Partei hat bereits einmal ihre no gewechselt */
|
||||
|
@ -57,10 +54,8 @@ extern "C" {
|
|||
struct faction *next;
|
||||
struct faction *nexthash;
|
||||
|
||||
#ifdef SMART_INTERVALS
|
||||
struct region *first;
|
||||
struct region *last;
|
||||
#endif
|
||||
int no;
|
||||
int subscription;
|
||||
int flags;
|
||||
|
@ -138,9 +133,7 @@ extern "C" {
|
|||
void free_factions(void);
|
||||
void remove_empty_factions(void);
|
||||
|
||||
#ifdef SMART_INTERVALS
|
||||
void update_interval(struct faction *f, struct region *r);
|
||||
#endif
|
||||
|
||||
const char *faction_getbanner(const struct faction *self);
|
||||
void faction_setbanner(struct faction *self, const char *name);
|
||||
|
|
|
@ -964,9 +964,7 @@ void move_unit(unit * u, region * r, unit ** ulist)
|
|||
addlist(ulist, u);
|
||||
}
|
||||
|
||||
#ifdef SMART_INTERVALS
|
||||
update_interval(u->faction, r);
|
||||
#endif
|
||||
u->region = r;
|
||||
}
|
||||
|
||||
|
|
|
@ -1147,9 +1147,7 @@ static void faction_add_seen(faction *f, region *r, seen_mode mode) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef SMART_INTERVALS
|
||||
update_interval(f, r);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** mark all regions seen by the lighthouse.
|
||||
|
@ -1270,16 +1268,11 @@ void reorder_units(region * r)
|
|||
|
||||
static region *lastregion(faction * f)
|
||||
{
|
||||
#ifdef SMART_INTERVALS
|
||||
return f->last ? f->last->next : NULL;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static region *firstregion(faction * f)
|
||||
{
|
||||
#ifdef SMART_INTERVALS
|
||||
region *r = f->first;
|
||||
|
||||
if (f->units == NULL)
|
||||
|
@ -1288,9 +1281,6 @@ static region *firstregion(faction * f)
|
|||
return r;
|
||||
|
||||
return f->first = regions;
|
||||
#else
|
||||
return regions;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_add_seen(region *r, unit *u, void *cbdata) {
|
||||
|
|
|
@ -80,12 +80,10 @@ void travelthru_add(region * r, unit * u)
|
|||
ql_push(&ql, u);
|
||||
a->data.v = ql;
|
||||
|
||||
#ifdef SMART_INTERVALS
|
||||
/* the first and last region of the faction gets reset, because travelthrough
|
||||
* could be in regions that are located before the [first, last] interval,
|
||||
* and recalculation is needed */
|
||||
update_interval(u->faction, r);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool travelthru_cansee(const struct region *r, const struct faction *f, const struct unit *u) {
|
||||
|
|
Loading…
Reference in New Issue