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);
fset(r, FL_MARK);
rsize = 1;
while (rsize && (nsize || isize>=REGIONS_PER_FACTION)) {
int i = rand() % rsize;
region_list ** rnext = &rlist;
region_list * rfind;
direction_t d;
while (i--) rnext=&(*rnext)->next;
r = (*rnext)->data;
*rnext = (*rnext)->next;
rfind = *rnext;
r = rfind->data;
freset(r, FL_MARK);
*rnext = rfind->next;
free(rfind);
--rsize;
for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d);
if (fval(rn, FL_MARK)) continue;
if (virgin_region(rn)) {
if (rn==NULL) {
rn = new_region(r->x + delta_x[d], r->y + delta_y[d]);
terraform(rn, T_OCEAN);
}
add_regionlist(&rlist, rn);
fset(rn, FL_MARK);
++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) {
/* reicht das? */
fix_demand(r);