forked from github/server
Prevent micro-islands from being extended.
This commit is contained in:
parent
bcf0b8d446
commit
ec86c9a572
|
@ -355,6 +355,7 @@ preferred_terrain(const struct race * rc)
|
||||||
|
|
||||||
#define REGIONS_PER_FACTION 2
|
#define REGIONS_PER_FACTION 2
|
||||||
#define PLAYERS_PER_ISLAND 20
|
#define PLAYERS_PER_ISLAND 20
|
||||||
|
#define MAXISLANDSIZE 50
|
||||||
#define MINFACTIONS 1
|
#define MINFACTIONS 1
|
||||||
#define MAXAGEDIFF 5
|
#define MAXAGEDIFF 5
|
||||||
#define VOLCANO_CHANCE 100
|
#define VOLCANO_CHANCE 100
|
||||||
|
@ -407,6 +408,34 @@ get_island(region * root, region_list ** rlist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
island_size(region * r)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
region_list * rlist = NULL;
|
||||||
|
region_list * island = NULL;
|
||||||
|
add_regionlist(&rlist, r);
|
||||||
|
island = rlist;
|
||||||
|
fset(r, FL_MARK);
|
||||||
|
while (rlist) {
|
||||||
|
direction_t d;
|
||||||
|
r = rlist->data;
|
||||||
|
++size;
|
||||||
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
|
region * rn = rconnect(r, d);
|
||||||
|
if (rn && !fval(rn, FL_MARK) && rn->land) {
|
||||||
|
add_regionlist(&rlist->next, rn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rlist = rlist->next;
|
||||||
|
}
|
||||||
|
for (rlist=island;rlist;rlist=rlist->next) {
|
||||||
|
freset(rlist->data, FL_MARK);
|
||||||
|
}
|
||||||
|
free_regionlist(island);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
/** create new island with up to nsize players
|
/** create new island with up to nsize players
|
||||||
* returns the number of players placed on the new island.
|
* returns the number of players placed on the new island.
|
||||||
*/
|
*/
|
||||||
|
@ -434,12 +463,16 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
region * rn = rconnect(r, d);
|
region * rn = rconnect(r, d);
|
||||||
if (rn && rn->land) {
|
if (rn && rn->land) {
|
||||||
|
/* only expand islands that aren't single-islands and not too big already */
|
||||||
|
int n = island_size(rn);
|
||||||
|
if (n>2 && n<MAXISLANDSIZE) {
|
||||||
rmin = rn;
|
rmin = rn;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (rmin!=NULL) {
|
if (rmin!=NULL) {
|
||||||
region_list * rlist = NULL, * rptr;
|
region_list * rlist = NULL, * rptr;
|
||||||
faction * f;
|
faction * f;
|
||||||
|
|
Loading…
Reference in New Issue