From ce4e496107e8e3c2dab9ffaa61b1d86fdd1c49ba Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 15 Oct 2023 16:21:10 -0400 Subject: [PATCH] Commiting again... --- main.adb | 3 +-- weapon.adb | 32 +++++++++++++++++++------------- weapon.ads | 5 +---- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/main.adb b/main.adb index e37c69a..05d14ec 100644 --- a/main.adb +++ b/main.adb @@ -26,8 +26,7 @@ begin map.generate; item.generate; - - weapon.create (weapon.iron_mace, 2, 2); + weapon.generate; ------------------------------------------------------------------------------------------ diff --git a/weapon.adb b/weapon.adb index 140d44e..f72af2f 100644 --- a/weapon.adb +++ b/weapon.adb @@ -12,26 +12,32 @@ package body weapon is ------------------------------------------------------------------------------------------ - procedure create (this : list; - y : map.height; - x : map.width) is + procedure generate is + y : natural := 0; + x : natural := 0; + identifier : natural := 0; begin - map.variable_data (1) := (2, 2, core.weapon, list'pos (this)); - end create; + for this in map.mark + loop + y := core.randomize (0, natural (map.height'last)); + x := core.randomize (0, natural (map.width'last)); + identifier := core.randomize (0, natural (list'size)); + map.variable_data (this) := (integer (y), integer (x), core.weapon, identifier); + end loop; + end generate; procedure render is symbol : character := ' '; colour : character := core.colour.white; effect : character := core.effect.normal; begin - symbol := constant_data (list'val (map.variable_data (1).identifier)).symbol; - colour := constant_data (list'val (map.variable_data (1).identifier)).colour; - effect := constant_data (list'val (map.variable_data (1).identifier)).effect; - core.render_character (symbol, colour, effect, core.screen_height (map.variable_data (1).y), core.screen_width (map.variable_data (1).x)); - --~for this in mark - --~loop - --~core.render_character ('@', core.colour.cyan, core.effect.bold, core.screen_height (map.variable_data (0)), core.screen_width (map.variable_data (0))); - --~end loop; + for this in map.mark + loop + symbol := constant_data (list'val (map.variable_data (this).identifier)).symbol; + colour := constant_data (list'val (map.variable_data (this).identifier)).colour; + effect := constant_data (list'val (map.variable_data (this).identifier)).effect; + core.render_character (symbol, colour, effect, core.screen_height (map.variable_data (this).y), core.screen_width (map.variable_data (this).x)); + end loop; end render; ------------------------------------------------------------------------------------------ diff --git a/weapon.ads b/weapon.ads index 7d86961..9c558eb 100644 --- a/weapon.ads +++ b/weapon.ads @@ -74,10 +74,7 @@ package weapon is ------------------------------------------------------------------------------------------ - procedure create (this : list; - y : map.height; - x : map.width); - + procedure generate; procedure render; ------------------------------------------------------------------------------------------