fairland: Report missing and stunted islands

fairland can create fewer and smaller islands than the user requested.
Report like this:

    No room for island #13
    6 stunted islands

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2020-07-25 08:13:54 +02:00
parent 41d9882860
commit 68375704b8
2 changed files with 19 additions and 6 deletions

View file

@ -861,21 +861,32 @@ place_island(int c, int *xp, int *yp)
static void
grow_islands(void)
{
int stunted_islands = 0;
int c, secs, x, y, isiz;
for (c = nc; c < nc + ni; ++c) {
secs = 0;
if (!place_island(c, &x, &y))
return;
if (!place_island(c, &x, &y)) {
qprint("\nNo room for island #%d", c - nc + 1);
break;
}
isiz = roll(is) + roll0(is);
do {
++secs;
for (secs = 1; secs < isiz; secs++) {
find_coast(c);
} while (secs < isiz && grow_one_sector(c));
if (!grow_one_sector(c)) {
stunted_islands++;
break;
}
}
find_coast(c);
qprint(" %d(%d)", c - nc + 1, secs);
ctot++;
}
if (stunted_islands)
qprint("\n%d stunted island%s",
stunted_islands, splur(stunted_islands));
}
/****************************************************************************

View file

@ -26,6 +26,8 @@ try #3 (out of 10)...
placing capitals...
growing continents...
growing islands: 1(14) 2(20) 3(11) 4(16) 5(14) 6(8) 7(2) 8(3) 9(4) 10(5) 11(14) 12(3)
No room for island #13
6 stunted islands
elevating land...
writing to sectors file...