From 8329dffae23c414ccbbf0486beb36f0c1f9edccc Mon Sep 17 00:00:00 2001 From: xolatile Date: Fri, 14 Jun 2024 17:00:08 -0400 Subject: [PATCH] Consistency related factoring, default record values and more... --- source/attribute.ads | 6 +++--- source/chad.ads | 16 ++++++++-------- source/construction.ads | 16 ++++++++-------- source/core.ads | 3 ++- source/deity.ads | 14 +++++++------- source/effect.ads | 2 +- source/equipment.ads | 6 +++--- source/faction.ads | 11 ++++++----- source/landmark.ads | 14 +++++++------- source/location.ads | 16 ++++++++-------- source/material.ads | 2 +- source/resource.ads | 6 +++--- source/skill.ads | 2 +- source/ui.adb | 6 ------ source/unit.ads | 2 +- source/world.adb | 2 +- source/world.ads | 36 ++++++++++++++++++------------------ 17 files changed, 78 insertions(+), 82 deletions(-) diff --git a/source/attribute.ads b/source/attribute.ads index d6af280..5d13222 100644 --- a/source/attribute.ads +++ b/source/attribute.ads @@ -15,9 +15,9 @@ package attribute is ------------------------------------------------------------------------------------------ type definition is record - base : core.point; - name : access string; - text : access string; + base : core.point := (0, 0); + name : access string := new string'("--"); + text : access string := new string'("--"); end record; type points is array (enumeration) of core.point; diff --git a/source/chad.ads b/source/chad.ads index 935eff8..29c03e7 100644 --- a/source/chad.ads +++ b/source/chad.ads @@ -15,17 +15,17 @@ package chad is ------------------------------------------------------------------------------------------ type definition is record - name : access string; - title : access string; - kind : faction.enumeration; - bonus_attribute : attribute.enumeration; - bonus_skill : skill.enumeration; - bonus_resource : resource.enumeration; + name : access string := new string'("--"); + title : access string := new string'("--"); + kind : faction.enumeration := faction.neutral; + bonus_attribute : attribute.enumeration := attribute.enumeration'first; + bonus_skill : skill.enumeration := skill.enumeration'first; + bonus_resource : resource.enumeration := resource.enumeration'first; end record; type information is record - index : enumeration := ada; - state : core.animation := core.idle; + index : enumeration := enumeration'first; + state : core.animation := core.animation'first; level : natural := 1; x : integer := 0; y : integer := 0; diff --git a/source/construction.ads b/source/construction.ads index d0ef30f..912b829 100644 --- a/source/construction.ads +++ b/source/construction.ads @@ -15,17 +15,17 @@ package construction is ------------------------------------------------------------------------------------------ type definition is record - name : access string; - kind : faction.enumeration; - price : resource.price; - frames : natural; - evoke : effect.information; + name : access string := new string'("--"); + kind : faction.enumeration := faction.neutral; + price : resource.price := (others => 0); + frames : natural := 0; + evoke : effect.information := effect.none; end record; type information is record - index : enumeration; - x : integer; - y : integer; + index : enumeration := enumeration'first; + x : integer := 0; + y : integer := 0; end record; type informations is array (natural range <>) of information; diff --git a/source/core.ads b/source/core.ads index 7ecc03b..6c14197 100644 --- a/source/core.ads +++ b/source/core.ads @@ -57,7 +57,8 @@ package core is type song is record index : integer; end record; type point is record - value, limit : natural; + value : natural := 0; + limit : natural := 0; end record; type string_box_data is record diff --git a/source/deity.ads b/source/deity.ads index 0286b8a..83c38de 100644 --- a/source/deity.ads +++ b/source/deity.ads @@ -17,12 +17,12 @@ package deity is ------------------------------------------------------------------------------------------ type definition is record - name : access string; - favor : integer; - loved_faction : faction.enumeration; - bonus_attribute : attribute.enumeration; - bonus_skill : skill.enumeration; - bonus_resource : resource.enumeration; + name : access string := new string'("--"); + favor : integer := 0; + loved_faction : faction.enumeration := faction.neutral; + bonus_attribute : attribute.enumeration := attribute.enumeration'first; + bonus_skill : skill.enumeration := skill.enumeration'first; + bonus_resource : resource.enumeration := resource.enumeration'first; end record; ------------------------------------------------------------------------------------------ @@ -43,7 +43,7 @@ package deity is XORANA => (new string'("Xorana"), -120, faction.neutral, attribute.wisdom, skill.eremnokinesis, resource.metal) ); - sprite : array (enumeration) of core.sprite; + game : array (enumeration) of core.sprite; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/effect.ads b/source/effect.ads index 1f82528..4fc5b9d 100644 --- a/source/effect.ads +++ b/source/effect.ads @@ -17,7 +17,7 @@ package effect is ------------------------------------------------------------------------------------------ type information is record - kind : enumeration := idle; + kind : enumeration := enumeration'first; modifier : integer := 0; amount : integer := 0; permanent : boolean := false; diff --git a/source/equipment.ads b/source/equipment.ads index 4612a07..37042f7 100644 --- a/source/equipment.ads +++ b/source/equipment.ads @@ -53,9 +53,9 @@ package equipment is end record; type information is record - index : enumeration; - x : integer; - y : integer; + index : enumeration := enumeration'first; + x : integer := 0; + y : integer := 0; end record; type informations is array (natural range <>) of information; diff --git a/source/faction.ads b/source/faction.ads index 911cb47..b1d0447 100644 --- a/source/faction.ads +++ b/source/faction.ads @@ -16,10 +16,10 @@ package faction is ------------------------------------------------------------------------------------------ type definition is record - name : access string; - bonus_attribute : attribute.enumeration; - bonus_skill : skill.enumeration; - bonus_resource : resource.enumeration; + name : access string := new string'("--"); + bonus_attribute : attribute.enumeration := attribute.enumeration'first; + bonus_skill : skill.enumeration := skill.enumeration'first; + bonus_resource : resource.enumeration := resource.enumeration'first; end record; ------------------------------------------------------------------------------------------ @@ -39,7 +39,8 @@ package faction is neutral => (new string'("Neutral"), attribute.offense, skill.archery, resource.gold) ); - sprite : array (enumeration) of core.sprite; + icon : array (enumeration) of core.sprite; + view : array (enumeration) of core.sprite; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/landmark.ads b/source/landmark.ads index bc9caf3..1da9874 100644 --- a/source/landmark.ads +++ b/source/landmark.ads @@ -19,16 +19,16 @@ package landmark is ------------------------------------------------------------------------------------------ type definition is record - name : access string; - spawn : biome.enumeration; - clip : boolean; - frames : integer; + name : access string := new string'("--"); + spawn : biome.enumeration := biome.enumeration'first; + clip : boolean := false; + frames : integer := 0; end record; type information is record - index : enumeration; - x : integer; - y : integer; + index : enumeration := enumeration'first; + x : integer := 0; + y : integer := 0; end record; type informations is array (natural range <>) of information; diff --git a/source/location.ads b/source/location.ads index 89fcd23..e83f624 100644 --- a/source/location.ads +++ b/source/location.ads @@ -17,17 +17,17 @@ package location is ------------------------------------------------------------------------------------------ type definition is record - name : access string; - clip : boolean; - frames : integer; - evoke : effect.information; + name : access string := new string'("--"); + clip : boolean := false; + frames : integer := 0; + evoke : effect.information := effect.none; end record; type information is record - index : enumeration; - used : boolean; - x : integer; - y : integer; + index : enumeration := enumeration'first; + used : boolean := false; + x : integer := 0; + y : integer := 0; end record; type informations is array (natural range <>) of information; diff --git a/source/material.ads b/source/material.ads index 897d99e..93dd860 100644 --- a/source/material.ads +++ b/source/material.ads @@ -25,7 +25,7 @@ package material is end record; type point is record - index : enumeration := none; + index : enumeration := enumeration'first; value : natural := 0; limit : natural := 0; end record; diff --git a/source/resource.ads b/source/resource.ads index f95b8cf..38e4ffe 100644 --- a/source/resource.ads +++ b/source/resource.ads @@ -15,9 +15,9 @@ package resource is ------------------------------------------------------------------------------------------ type definition is record - base : core.point; - name : access string; - text : access string; + base : core.point := (0, 0); + name : access string := new string'("--"); + text : access string := new string'("--"); end record; type points is array (enumeration) of core.point; diff --git a/source/skill.ads b/source/skill.ads index 99b20bd..15e182a 100644 --- a/source/skill.ads +++ b/source/skill.ads @@ -24,7 +24,7 @@ package skill is end record; type point is record - index : enumeration := none; + index : enumeration := enumeration'first; value : natural := 0; limit : natural := 0; end record; diff --git a/source/ui.adb b/source/ui.adb index 1473787..3dd83db 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -47,12 +47,6 @@ package body ui is ------------------------------------------------------------------------------------------ - type rectangle is record - x, y, width, height : integer; - end record; - - ------------------------------------------------------------------------------------------ - font_tint : array (style) of core.colour := ( main => (127, 127, 127, 255), fairy => ( 0, 127, 255, 255), diff --git a/source/unit.ads b/source/unit.ads index 3fa888e..af70920 100644 --- a/source/unit.ads +++ b/source/unit.ads @@ -29,7 +29,7 @@ package unit is end record; type information is record - index : enumeration := none; + index : enumeration := enumeration'first; state : core.animation := core.idle; x : integer := 0; y : integer := 0; diff --git a/source/world.adb b/source/world.adb index 9668ddc..7dd7818 100644 --- a/source/world.adb +++ b/source/world.adb @@ -160,7 +160,7 @@ package body world is core.echo (core.comment, "Configuring" & deity.count'image & " deity components..."); -- for index in deity.enumeration loop - deity.sprite (index) := core.import_sprite (core.folder & "/game/deity/" & deity.enumeration'image (index) & ".png", 4, 1); + deity.game (index) := core.import_sprite (core.folder & "/game/deity/" & deity.enumeration'image (index) & ".png", 4, 1); end loop; -- core.echo (core.comment, "Configuring" & construction.count'image & " construction components..."); diff --git a/source/world.ads b/source/world.ads index a213a0f..f29f4c4 100644 --- a/source/world.ads +++ b/source/world.ads @@ -17,24 +17,24 @@ package world is type boolean_matrix is array (natural range <>, natural range <>) of boolean; type definition is record - kind : biome.enumeration; - width : natural; - height : natural; - tiles : access integer_matrix; - clips : access boolean_matrix; - views : access boolean_matrix; - landmark_count : core.point; - location_count : core.point; - construction_count : core.point; - equipment_count : core.point; - unit_count : core.point; - chad_count : core.point; - landmarks : access landmark.informations; - locations : access location.informations; - constructions : access construction.informations; - equipments : access equipment.informations; - units : access unit.informations; - chads : access chad.informations; + kind : biome.enumeration := biome.enumeration'first; + width : natural := 0; + height : natural := 0; + tiles : access integer_matrix := null; + clips : access boolean_matrix := null; + views : access boolean_matrix := null; + landmark_count : core.point := (0, 0); + location_count : core.point := (0, 0); + construction_count : core.point := (0, 0); + equipment_count : core.point := (0, 0); + unit_count : core.point := (0, 0); + chad_count : core.point := (0, 0); + landmarks : access landmark.informations := null; + locations : access location.informations := null; + constructions : access construction.informations := null; + equipments : access equipment.informations := null; + units : access unit.informations := null; + chads : access chad.informations := null; end record; ------------------------------------------------------------------------------------------