fairland: Check first two continent sectors properly

grow_continents() places the first two continent sectors without
checking for collisions or minimum distance.  Unlikely to be an issue
in practice, as growing such a continent will almost certainly fail.
Fix it anyway.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2020-08-11 07:52:45 +02:00
parent f314ead777
commit 41d9882860

View file

@ -791,13 +791,17 @@ grow_continents(void)
int c, secs; int c, secs;
for (c = 0; c < nc; ++c) { for (c = 0; c < nc; ++c) {
sectx[c][0] = capx[c]; isecs[c] = 0;
secty[c][0] = capy[c]; if (!try_to_grow(c, capx[c], capy[c], di)
own[sectx[c][0]][secty[c][0]] = c; || !try_to_grow(c, new_x(capx[c] + 2), capy[c], di)) {
sectx[c][1] = new_x(capx[c] + 2); done = 0;
secty[c][1] = capy[c]; continue;
own[sectx[c][1]][secty[c][1]] = c; }
isecs[c] = 2; }
if (!done) {
qprint("No room for continents\n");
return 0;
} }
for (secs = 2; secs < sc && done; secs++) { for (secs = 2; secs < sc && done; secs++) {