From 35a568f6ab9334e4c7f8fe443d86be0f62be2d56 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 1 Jun 2024 18:25:10 -0400 Subject: [PATCH] Resource and skill refactoring... --- source/resource.adb | 11 ++++++++++- source/resource.ads | 7 +++++-- source/skill.adb | 11 ++++++++++- source/skill.ads | 9 ++++++--- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/source/resource.adb b/source/resource.adb index 5463037..15b8eb5 100644 --- a/source/resource.adb +++ b/source/resource.adb @@ -17,8 +17,15 @@ package body resource is end define; -- structure : ui.structure; + -- + time : float := 0.0; begin - core.echo (core.comment, "Configuring resource components..."); + time := core.time; + -- + core.echo (core.comment, "Configuring" & count'image & " resource components..."); + -- + description := new description_array (enumeration'range); + icon := new icon_array (enumeration'range); -- define (gold, 24, 480, "Gold", "Gold is precious yellowish shiny metal, valued since ancient times."); define (wood, 12, 240, "Wood", "Wood is just bundle of lignin and cellulose, nothing more."); @@ -43,6 +50,8 @@ package body resource is -- ui.add_structure_button (icon (index), description (index).name, description (index).text); end loop; + -- + core.echo (core.success, "Successfully configured resource information in" & natural'image (natural (1_000_000.0 * (core.time - time))) & " microseconds."); end configure; ------------------------------------------------------------------------------------------ diff --git a/source/resource.ads b/source/resource.ads index 0c856c8..4a87e0b 100644 --- a/source/resource.ads +++ b/source/resource.ads @@ -23,12 +23,15 @@ package resource is type points is array (enumeration) of core.point; type price is array (enumeration) of natural; + type description_array is array (enumeration range <>) of definition; + type icon_array is array (enumeration range <>) of core.sprite; + ------------------------------------------------------------------------------------------ count : constant natural := enumeration'pos (enumeration'last) + 1; - description : array (enumeration) of definition; - icon : array (enumeration) of core.sprite; + description : access description_array; + icon : access icon_array; ------------------------------------------------------------------------------------------ diff --git a/source/skill.adb b/source/skill.adb index 786d91e..95d15bb 100644 --- a/source/skill.adb +++ b/source/skill.adb @@ -17,8 +17,15 @@ package body skill is end define; -- structure : ui.structure; + -- + time : float := 0.0; begin - core.echo (core.comment, "Configuring skill components..."); + time := core.time; + -- + core.echo (core.comment, "Configuring" & count'image & " skill components..."); + -- + description := new description_array (enumeration'range); + icon := new icon_array (enumeration'range); -- define (alchemy, 0, 24, "Alchemy", "Alchemy skill determines effectiveness of your vials and potions."); define (archery, 0, 24, "Archery", "Archery skill determines effectiveness and range or your archers."); @@ -59,6 +66,8 @@ package body skill is -- ui.add_structure_button (icon (index), description (index).name, description (index).text); end loop; + -- + core.echo (core.success, "Successfully configured skill information in" & natural'image (natural (1_000_000.0 * (core.time - time))) & " microseconds."); end configure; ------------------------------------------------------------------------------------------ diff --git a/source/skill.ads b/source/skill.ads index bd65a25..fe96d31 100644 --- a/source/skill.ads +++ b/source/skill.ads @@ -25,14 +25,17 @@ package skill is type points is array (enumeration) of core.point; type bonus is array (enumeration) of natural; - default : points := (others => (0, 24)); + type description_array is array (enumeration range <>) of definition; + type icon_array is array (enumeration range <>) of core.sprite; ------------------------------------------------------------------------------------------ count : constant natural := enumeration'pos (enumeration'last) + 1; - description : array (enumeration) of definition; - icon : array (enumeration) of core.sprite; + default : constant points := (others => (0, 24)); + + description : access description_array; + icon : access icon_array; ------------------------------------------------------------------------------------------