autoseed setzt nicht mehr 2 Parteien in der gleiceh Region aus, und asserted deshalb auch nicht. So jedenfalls der Plan...

This commit is contained in:
Enno Rehling 2005-05-01 17:46:33 +00:00
parent 48b597e972
commit 5831dc5df4
1 changed files with 16 additions and 2 deletions

View File

@ -497,24 +497,31 @@ autoseed(newfaction ** players, int nsize)
} }
add_regionlist(&rlist, r); add_regionlist(&rlist, r);
fset(r, FL_MARK);
rsize = 1; rsize = 1;
while (rsize && (nsize || isize>=REGIONS_PER_FACTION)) { while (rsize && (nsize || isize>=REGIONS_PER_FACTION)) {
int i = rand() % rsize; int i = rand() % rsize;
region_list ** rnext = &rlist; region_list ** rnext = &rlist;
region_list * rfind;
direction_t d; direction_t d;
while (i--) rnext=&(*rnext)->next; while (i--) rnext=&(*rnext)->next;
r = (*rnext)->data; rfind = *rnext;
*rnext = (*rnext)->next; r = rfind->data;
freset(r, FL_MARK);
*rnext = rfind->next;
free(rfind);
--rsize; --rsize;
for (d=0;d!=MAXDIRECTIONS;++d) { for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d); region * rn = rconnect(r, d);
if (fval(rn, FL_MARK)) continue;
if (virgin_region(rn)) { if (virgin_region(rn)) {
if (rn==NULL) { if (rn==NULL) {
rn = new_region(r->x + delta_x[d], r->y + delta_y[d]); rn = new_region(r->x + delta_x[d], r->y + delta_y[d]);
terraform(rn, T_OCEAN); terraform(rn, T_OCEAN);
} }
add_regionlist(&rlist, rn); add_regionlist(&rlist, rn);
fset(rn, FL_MARK);
++rsize; ++rsize;
} }
} }
@ -560,6 +567,13 @@ autoseed(newfaction ** players, int nsize)
} }
} }
while (rlist) {
region_list * self = rlist;
rlist = rlist->next;
freset(self->data, FL_MARK);
free(self);
}
if (r!=NULL) { if (r!=NULL) {
/* reicht das? */ /* reicht das? */
fix_demand(r); fix_demand(r);