forked from github/server
- order in nr is now same as in template again.
- generation for list of reigons is getting slower, though
This commit is contained in:
parent
03a967c2c4
commit
a79501bb78
|
@ -2470,7 +2470,6 @@ merian(FILE * out, faction * f)
|
||||||
#endif
|
#endif
|
||||||
seen_region * seen;
|
seen_region * seen;
|
||||||
seen_region * reuse;
|
seen_region * reuse;
|
||||||
seen_region** append;
|
|
||||||
seen_region * last;
|
seen_region * last;
|
||||||
|
|
||||||
#define MAXSEEHASH 4095
|
#define MAXSEEHASH 4095
|
||||||
|
@ -2554,18 +2553,43 @@ add_seen(const struct region * r, unsigned char mode, boolean dis)
|
||||||
{
|
{
|
||||||
seen_region * find = find_seen(r);
|
seen_region * find = find_seen(r);
|
||||||
if (find==NULL) {
|
if (find==NULL) {
|
||||||
|
seen_region * insert;
|
||||||
int index = abs((r->x & 0xffff) + ((r->y) << 16)) % MAXSEEHASH;
|
int index = abs((r->x & 0xffff) + ((r->y) << 16)) % MAXSEEHASH;
|
||||||
if (!reuse) reuse = (seen_region*)calloc(1, sizeof(struct seen_region));
|
if (!reuse) reuse = (seen_region*)calloc(1, sizeof(struct seen_region));
|
||||||
*append = find = reuse;
|
find = reuse;
|
||||||
reuse = reuse->next;
|
reuse = reuse->next;
|
||||||
find->nextHash = seehash[index];
|
find->nextHash = seehash[index];
|
||||||
seehash[index] = find;
|
seehash[index] = find;
|
||||||
find->r = r;
|
find->r = r;
|
||||||
if (last) last->next = find;
|
|
||||||
find->next = NULL;
|
for (insert=last;insert;insert=insert->next) {
|
||||||
find->prev = last;
|
const region * rl;
|
||||||
|
seen_region * inext = insert->next;
|
||||||
|
for (rl=insert->r;rl && (!inext || rl!=inext->r);rl=rl->next) {
|
||||||
|
if (rl==r) break;
|
||||||
|
}
|
||||||
|
if (rl==r) break;
|
||||||
|
}
|
||||||
|
if (insert==0) {
|
||||||
|
for (insert=seen;insert!=last;insert=insert->next) {
|
||||||
|
const region * rl;
|
||||||
|
seen_region * inext = insert->next;
|
||||||
|
for (rl=insert->r;rl && (!inext || rl!=inext->r);rl=rl->next) {
|
||||||
|
if (rl==r) break;
|
||||||
|
}
|
||||||
|
if (rl==r) break;
|
||||||
|
}
|
||||||
|
if (insert==last) insert=0;
|
||||||
|
}
|
||||||
last = find;
|
last = find;
|
||||||
append = &last->next;
|
find->prev = insert;
|
||||||
|
if (insert!=0) {
|
||||||
|
find->next = insert->next;
|
||||||
|
insert->next = find;
|
||||||
|
} else {
|
||||||
|
find->next = seen;
|
||||||
|
seen = find;
|
||||||
|
}
|
||||||
} else if (find->mode >= mode) {
|
} else if (find->mode >= mode) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2676,14 +2700,13 @@ prepare_report(faction * f)
|
||||||
{
|
{
|
||||||
region * r;
|
region * r;
|
||||||
region * end = lastregion(f);
|
region * end = lastregion(f);
|
||||||
|
seen_region ** append = &reuse;
|
||||||
|
|
||||||
append = &reuse;
|
|
||||||
memset(seehash, 0, sizeof(seehash));
|
|
||||||
while (*append) append = &(*append)->next;
|
while (*append) append = &(*append)->next;
|
||||||
*append = seen;
|
*append = seen;
|
||||||
|
memset(seehash, 0, sizeof(seehash));
|
||||||
seen = NULL;
|
seen = NULL;
|
||||||
last = NULL;
|
last = NULL;
|
||||||
append = &seen;
|
|
||||||
for (r = firstregion(f); r != end; r = r->next) {
|
for (r = firstregion(f); r != end; r = r->next) {
|
||||||
attrib *ru;
|
attrib *ru;
|
||||||
unit * u;
|
unit * u;
|
||||||
|
|
|
@ -865,7 +865,7 @@ use_tacticcrystal(region * r, unit * u, int amount, strlist * cmdstrings)
|
||||||
int power = 5; /* Widerstand gegen Antimagiesprüche, ist in diesem
|
int power = 5; /* Widerstand gegen Antimagiesprüche, ist in diesem
|
||||||
Fall egal, da der curse für den Kampf gelten soll,
|
Fall egal, da der curse für den Kampf gelten soll,
|
||||||
der vor den Antimagiezaubern passiert */
|
der vor den Antimagiezaubern passiert */
|
||||||
curse * c = create_curse(u, &u->attribs, ct_find("skill"), power,
|
curse * c = create_curse(u, &u->attribs, ct_find("skillmod"), power,
|
||||||
duration, effect, u->number);
|
duration, effect, u->number);
|
||||||
c->data = (void*)SK_TACTICS;
|
c->data = (void*)SK_TACTICS;
|
||||||
unused(cmdstrings);
|
unused(cmdstrings);
|
||||||
|
|
Loading…
Reference in New Issue