|
|
@@ -2,11 +2,8 @@ |
|
|
|
-- |
|
|
|
-- GNU General Public Licence (version 3 or later) |
|
|
|
|
|
|
|
--~with ada.strings.fixed; |
|
|
|
with core, resource, item, unit, construction, world; |
|
|
|
|
|
|
|
use world; |
|
|
|
|
|
|
|
package body world is |
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
@@ -40,12 +37,12 @@ package body world is |
|
|
|
-- |
|
|
|
for index in codex |
|
|
|
loop |
|
|
|
landmarks (index) := new sprite_array (0 .. limit (index)); |
|
|
|
for value in 0 .. limit (index) |
|
|
|
landmarks (index) := new sprite_array (0 .. limit (index) - 1); |
|
|
|
-- |
|
|
|
for value in 0 .. limit (index) - 1 |
|
|
|
loop |
|
|
|
declare |
|
|
|
folder : constant string := core.lowercase (codex'image (index)); |
|
|
|
--~file : constant string := ada.strings.fixed.trim (value'image, ada.strings.left); |
|
|
|
file : constant string := value'image; |
|
|
|
begin |
|
|
|
landmarks (index) (value) := core.import_sprite ("./sprite/world/landmark/" & folder & "/" & file & ".png", 1, 1); |
|
|
@@ -59,6 +56,7 @@ package body world is |
|
|
|
procedure make (index : in codex; width, height : in natural) 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); |
|
|
@@ -84,7 +82,7 @@ package body world is |
|
|
|
-- |
|
|
|
for object in 0 .. landmark_limit |
|
|
|
loop |
|
|
|
map.landmark (object).index := core.random_integer (0, limit (index)); |
|
|
|
map.landmark (object).index := core.random_integer (0, limit (index) - 1); |
|
|
|
map.landmark (object).x := core.base * core.random_integer (1, map.width - 1); |
|
|
|
map.landmark (object).y := core.base * core.random_integer (1, map.height - 1); |
|
|
|
end loop; |
|
|
|