From 68375704b8dcc995ac1457dd868570c3e6f71100 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 25 Jul 2020 08:13:54 +0200 Subject: [PATCH] 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 --- src/util/fairland.c | 23 +++++++++++++++++------ tests/fairland/stunted.out | 2 ++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/util/fairland.c b/src/util/fairland.c index 3025f86e8..c42fbbb3d 100644 --- a/src/util/fairland.c +++ b/src/util/fairland.c @@ -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)); } /**************************************************************************** diff --git a/tests/fairland/stunted.out b/tests/fairland/stunted.out index ed57497fc..fb80fb962 100644 --- a/tests/fairland/stunted.out +++ b/tests/fairland/stunted.out @@ -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... -- 2.43.0