Happy with lake generation...
This commit is contained in:
parent
96a6b073c5
commit
2436aebe22
@ -112,47 +112,19 @@ package body world is
|
||||
for this in 1 .. lake_count loop
|
||||
declare lake_x : integer := 0;
|
||||
lake_y : integer := 0;
|
||||
factor : boolean := false;
|
||||
starts : integer := 0;
|
||||
length : integer := 0;
|
||||
begin
|
||||
lake_x := core.random (2 * lake_reach, map.width - 2 * lake_reach - 1);
|
||||
lake_y := core.random (2 * lake_reach, map.height - 2 * lake_reach - 1);
|
||||
--
|
||||
for x in -lake_reach .. lake_reach loop
|
||||
for y in -lake_reach .. lake_reach loop
|
||||
factor := core.random (0, abs (x * y)) > abs (x * y) / 6;
|
||||
--
|
||||
map.tiles (lake_x + x, lake_y + y) := (if factor then core.random (0, 17) else core.random (18, 23));
|
||||
end loop;
|
||||
end loop;
|
||||
--
|
||||
for x in -lake_reach .. lake_reach loop
|
||||
for y in -lake_reach .. lake_reach loop
|
||||
for again in 0 .. 3 loop
|
||||
if map.tiles (lake_x + x, lake_y + y) < 18 then
|
||||
if boolean'pos (map.tiles (lake_x + x - 1, lake_y + y - 1) > 17) +
|
||||
boolean'pos (map.tiles (lake_x + x - 1, lake_y + y ) > 17) +
|
||||
boolean'pos (map.tiles (lake_x + x - 1, lake_y + y + 1) > 17) +
|
||||
boolean'pos (map.tiles (lake_x + x, lake_y + y - 1) > 17) +
|
||||
boolean'pos (map.tiles (lake_x + x, lake_y + y ) > 17) +
|
||||
boolean'pos (map.tiles (lake_x + x, lake_y + y + 1) > 17) +
|
||||
boolean'pos (map.tiles (lake_x + x + 1, lake_y + y - 1) > 17) +
|
||||
boolean'pos (map.tiles (lake_x + x + 1, lake_y + y ) > 17) +
|
||||
boolean'pos (map.tiles (lake_x + x + 1, lake_y + y + 1) > 17) > 3 then
|
||||
map.tiles (lake_x + x, lake_y + y) := core.random (18, 23);
|
||||
end if;
|
||||
--~else
|
||||
--~if boolean'pos (map.tiles (lake_x + x - 1, lake_y + y - 1) < 18) +
|
||||
--~boolean'pos (map.tiles (lake_x + x - 1, lake_y + y ) < 18) +
|
||||
--~boolean'pos (map.tiles (lake_x + x - 1, lake_y + y + 1) < 18) +
|
||||
--~boolean'pos (map.tiles (lake_x + x, lake_y + y - 1) < 18) +
|
||||
--~boolean'pos (map.tiles (lake_x + x, lake_y + y ) < 18) +
|
||||
--~boolean'pos (map.tiles (lake_x + x, lake_y + y + 1) < 18) +
|
||||
--~boolean'pos (map.tiles (lake_x + x + 1, lake_y + y - 1) < 18) +
|
||||
--~boolean'pos (map.tiles (lake_x + x + 1, lake_y + y ) < 18) +
|
||||
--~boolean'pos (map.tiles (lake_x + x + 1, lake_y + y + 1) < 18) > 3 then
|
||||
--~map.tiles (lake_x + x, lake_y + y) := core.random (0, 17);
|
||||
--~end if;
|
||||
end if;
|
||||
for x in -lake_reach / 2 .. lake_reach / 2 loop
|
||||
starts := core.random (0, abs x);
|
||||
length := core.random (lake_reach / 2, lake_reach - starts);
|
||||
--
|
||||
for repeat in 0 .. 1 loop
|
||||
for y in starts .. starts + length loop
|
||||
map.tiles (lake_x + 2 * x + repeat, lake_y + y) := core.random (18, 23);
|
||||
end loop;
|
||||
end loop;
|
||||
end loop;
|
||||
|
Loading…
Reference in New Issue
Block a user