fairland: Drop place_island() parameters @xp, @yp

There is no need to pass coordinates back to the caller.  Replace
parameters @xp, @yp by local variables @x, @y.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2020-08-09 17:13:33 +02:00
parent 4bbd8b9fb3
commit 001674e5c5

View file

@ -936,12 +936,14 @@ grow_continents(void)
GROW THE ISLANDS GROW THE ISLANDS
****************************************************************************/ ****************************************************************************/
/* Choose a place to start growing an island from /*
* Place additional island @c's first sector.
* Return 1 on success, 0 on error.
*/ */
static int static int
place_island(int c, int *xp, int *yp) place_island(int c)
{ {
int d, sx, sy; int d, sx, sy, x, y;
int ssy = roll0(WORLD_Y); int ssy = roll0(WORLD_Y);
int ssx = new_x(roll0(WORLD_X / 2) * 2 + ssy % 2); int ssx = new_x(roll0(WORLD_X / 2) * 2 + ssy % 2);
@ -950,15 +952,15 @@ place_island(int c, int *xp, int *yp)
for (d = di; d >= 0; --d) { for (d = di; d >= 0; --d) {
sx = ssx; sx = ssx;
sy = ssy; sy = ssy;
*xp = new_x(sx + 2); x = new_x(sx + 2);
for (*yp = sy; *xp != sx || *yp != sy; *xp += 2) { for (y = sy; x != sx || y != sy; x += 2) {
if (*xp >= WORLD_X) { if (x >= WORLD_X) {
*yp = new_y(*yp + 1); y = new_y(y + 1);
*xp = *yp % 2; x = y % 2;
if (*xp == sx && *yp == sy) if (x == sx && y == sy)
break; break;
} }
if (try_to_grow(c, *xp, *yp, d)) if (try_to_grow(c, x, y, d))
return 1; return 1;
} }
} }
@ -972,12 +974,12 @@ static void
grow_islands(void) grow_islands(void)
{ {
int stunted_islands = 0; int stunted_islands = 0;
int c, secs, x, y, isiz; int c, secs, isiz;
xzone_init(nc); xzone_init(nc);
for (c = nc; c < nc + ni; ++c) { for (c = nc; c < nc + ni; ++c) {
if (!place_island(c, &x, &y)) { if (!place_island(c)) {
qprint("\nNo room for island #%d", c - nc + 1); qprint("\nNo room for island #%d", c - nc + 1);
break; break;
} }