diff --git a/source/world.adb b/source/world.adb index c92c86c..6a6483d 100644 --- a/source/world.adb +++ b/source/world.adb @@ -28,16 +28,16 @@ package body world is begin core.echo (core.comment, "-- Procedurally generating new map..."); -- - core.echo (core.comment, "-- -- Map type : " & index'image); - core.echo (core.comment, "-- -- Map width :" & width'image); - core.echo (core.comment, "-- -- Map height :" & height'image); - core.echo (core.comment, "-- -- Landmark count :" & landmark_limit'image); + core.echo (core.comment, "-- -- Map type : " & index'image); + core.echo (core.comment, "-- -- Map width :" & width'image); + core.echo (core.comment, "-- -- Map height :" & height'image); + core.echo (core.comment, "-- -- Landmark count :" & landmark_limit'image); -- map.kind := index; map.width := width; map.height := height; - map.tiles := new tile_array (0 .. map.width - 1, 0 .. map.height - 1); - map.landmarks := new landmark_array (1 .. landmark_limit); + map.tiles := new tile_array (0 .. map.width - 1, 0 .. map.height - 1); + map.landmarks := new entity_array (1 .. landmark_limit); -- for x in 0 .. width - 1 loop for y in 0 .. height - 1 loop @@ -46,11 +46,12 @@ package body world is end loop; -- for index in 1 .. landmark_limit loop - map.landmarks (index).index := landmark_index'val (core.random (0, 8)); + map.landmarks (index).index := core.random (0, 8); map.landmarks (index).x := core.random (0, map.width - 1); map.landmarks (index).y := core.random (0, map.height - 1); end loop; -- + -- core.echo (core.success, "Finished procedurally generating new map."); end make; @@ -94,7 +95,7 @@ package body world is end loop; -- for index in 1 .. landmark_limit loop - core.draw (data => landmarks (map.landmarks (index).index), + core.draw (data => landmarks (landmark_index'val (map.landmarks (index).index)), x => offset.x + (map.landmarks (index).x - core.camera.x) * core.base * core.zoom, y => offset.y + (map.landmarks (index).y - core.camera.y) * core.base * core.zoom); end loop; diff --git a/source/world.ads b/source/world.ads index a346bab..3200521 100644 --- a/source/world.ads +++ b/source/world.ads @@ -15,7 +15,8 @@ package world is ------------------------------------------------------------------------------------------ type landmark_index is ( - dead_tree, mossy_rock, palm_tree, pine_tree, reeds, rock, snowed_pine_tree, snowed_rock, spiky_rock + dead_tree, mossy_rock, palm_tree, pine_tree, reeds, rock, + snowed_pine_tree, snowed_rock, spiky_rock ); type landmark_trait is record @@ -24,20 +25,21 @@ package world is frames : integer; end record; - type landmark_value is record - index : landmark_index; + type entity_trait is record + index : natural; x, y : integer; end record; - type tile_array is array (natural range <>, natural range <>) of integer; - type landmark_array is array (natural range <>) of landmark_value; + type tile_array is array (natural range <>, natural range <>) of integer; + type entity_array is array (natural range <>) of entity_trait; type information is record - kind : biome; - width : natural; - height : natural; - tiles : access tile_array; - landmarks : access landmark_array; + kind : biome; + width : natural; + height : natural; + tiles : access tile_array; + landmarks : access entity_array; + constructions : access entity_array; end record; ------------------------------------------------------------------------------------------