Better version of the ocean-age fixes produces proper firewalls around the

world
This commit is contained in:
Enno Rehling 2005-09-03 07:50:00 +00:00
parent d09071eff7
commit b7ebf40866
2 changed files with 20 additions and 6 deletions

View File

@ -887,7 +887,10 @@ demographics(void)
#endif
for (r = regions; r; r = r->next) {
++r->age;
if (r->age>0 || rterrain(r)!=T_OCEAN) {
/* oceans get their initial age in frame_regions() */
++r->age;
}
live(r);
/* check_split_dragons(); */

View File

@ -749,14 +749,25 @@ fix_gates(void)
static void
frame_regions(void)
{
unsigned short page = turn;
unsigned short ocean_age = turn;
region * r = regions;
for (r=regions;r;r=r->next) {
direction_t d;
if (rterrain(r) == T_OCEAN && r->age+1<page) {
r->age = page;
} else if (r->age<page) {
page = r->age;
if (rterrain(r) == T_OCEAN && r->age==0) {
unsigned short age = 0;
direction_t d;
for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d);
if (rn && rn->age>age) {
age = rn->age;
}
}
if (age!=0 && age < ocean_age) {
ocean_age = age;
}
r->age = ocean_age;
} else if (r->age>ocean_age) {
ocean_age = r->age;
}
if (r->age<16) continue;