forked from github/server
Test eines mapper-fixes
This commit is contained in:
parent
86c0a65184
commit
b886afa00f
|
@ -327,16 +327,29 @@ mkisland(int nsize)
|
||||||
terraform(r, T_OCEAN);
|
terraform(r, T_OCEAN);
|
||||||
add_regionlist(&rlist, r);
|
add_regionlist(&rlist, r);
|
||||||
rsize = 1;
|
rsize = 1;
|
||||||
while (rlist && nsize && newfactions) {
|
while (nsize) {
|
||||||
int i = rand() % rsize;
|
int i = rand() % rsize;
|
||||||
regionlist ** rnext = &rlist;
|
regionlist ** rnext = &rlist;
|
||||||
direction_t d;
|
direction_t d;
|
||||||
while (i--) rnext=&(*rnext)->next;
|
while (i--) rnext=&(*rnext)->next;
|
||||||
r = (*rnext)->region;
|
r = (*rnext)->region;
|
||||||
*rnext = (*rnext)->next;
|
*rnext = (*rnext)->next;
|
||||||
|
if (rsize==0) {
|
||||||
|
log_error(("Could not place all factions on the same island as requested\n"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
--rsize;
|
--rsize;
|
||||||
assert(r->terrain==T_OCEAN);
|
assert(r->terrain==T_OCEAN);
|
||||||
if (rand() % REGIONS_PER_FACTION == 0) {
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
|
region * rn = rconnect(r, d);
|
||||||
|
if (rn==NULL) {
|
||||||
|
rn = new_region(r->x + delta_x[d], r->y + delta_y[d]);
|
||||||
|
terraform(rn, T_OCEAN);
|
||||||
|
add_regionlist(&rlist, rn);
|
||||||
|
++rsize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rand() % REGIONS_PER_FACTION == 0 || rsize==0) {
|
||||||
newfaction ** nfp, * nextf = newfactions;
|
newfaction ** nfp, * nextf = newfactions;
|
||||||
unit * u;
|
unit * u;
|
||||||
terraform(r, preferred_terrain(nextf->race));
|
terraform(r, preferred_terrain(nextf->race));
|
||||||
|
@ -358,15 +371,6 @@ mkisland(int nsize)
|
||||||
else {
|
else {
|
||||||
terraform(r, (terrain_t)((rand() % T_GLACIER)+1));
|
terraform(r, (terrain_t)((rand() % T_GLACIER)+1));
|
||||||
}
|
}
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
|
||||||
region * rn = rconnect(r, d);
|
|
||||||
if (rn==NULL) {
|
|
||||||
rn = new_region(r->x + delta_x[d], r->y + delta_y[d]);
|
|
||||||
terraform(rn, T_OCEAN);
|
|
||||||
add_regionlist(&rlist, rn);
|
|
||||||
++rsize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (rlist) {
|
if (rlist) {
|
||||||
regionlist ** rbegin = &rlist;
|
regionlist ** rbegin = &rlist;
|
||||||
|
|
Loading…
Reference in New Issue