From f65c8c252f2b0e1e295f554c4ba99832723cd882 Mon Sep 17 00:00:00 2001 From: xolatile Date: Thu, 23 May 2024 02:58:30 -0400 Subject: [PATCH] Using points, work in progress... --- source/construction.ads | 2 +- source/core.adb | 8 ++++---- source/main.adb | 4 ++-- source/resource.adb | 2 +- source/resource.ads | 3 ++- source/world.adb | 1 + 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/source/construction.ads b/source/construction.ads index 6eb639e..2972c12 100644 --- a/source/construction.ads +++ b/source/construction.ads @@ -17,7 +17,7 @@ package construction is type information is record name : core.short_string; kind : faction.enumeration; - price : resource.points; + price : resource.prices; frames : integer; evoke : effect.value; end record; diff --git a/source/core.adb b/source/core.adb index 45ae300..ce62091 100644 --- a/source/core.adb +++ b/source/core.adb @@ -56,7 +56,7 @@ package body core is function "+" (data : in point; modifier : in natural) return point is this : point := data; begin - this.value := (if (data.value + modifier) > data.limit then data.limit else (data.value + modifier)); + this.value := (if (this.value + modifier) > this.limit then this.limit else (this.value + modifier)); -- return this; end "+"; @@ -66,7 +66,7 @@ package body core is function "-" (data : in point; modifier : in natural) return point is this : point := data; begin - this.value := (if (data.value - modifier) <= 0 then 0 else (data.value - modifier)); + this.value := (if (this.value - modifier) <= 0 then 0 else (this.value - modifier)); -- return this; end "-"; @@ -76,7 +76,7 @@ package body core is function "*" (data : in point; modifier : in natural) return point is this : point := data; begin - this.value := (if (data.value * modifier) > data.limit then data.limit else (data.value * modifier)); + this.value := (if (this.value * modifier) > this.limit then this.limit else (this.value * modifier)); -- return this; end "*"; @@ -86,7 +86,7 @@ package body core is function "/" (data : in point; modifier : in natural) return point is this : point := data; begin - this.value := (if (data.value / modifier) <= 0 then 0 else (data.value / modifier)); + this.value := (if (this.value / modifier) <= 0 then 0 else (this.value / modifier)); -- return this; end "/"; diff --git a/source/main.adb b/source/main.adb index 0c612c5..e8e6bce 100644 --- a/source/main.adb +++ b/source/main.adb @@ -31,9 +31,9 @@ procedure main is stamina => (10, 20), attributes => (1, 2, 3, 4, 5, 6), skills => (1, 2, 3, 4, 5, 6, 7, 8, 9, others => 0), - resources => (101, 103, 107, 109, 113, 127), + resources => ((101, 240), (103, 240), (107, 240), (109, 240), (113, 240), (127, 240)), equipments => (equipment.chest => equipment.elven_armour, - --~equipment.head => equipment.elven_helmet, + equipment.head => equipment.elven_helmet, equipment.hands => equipment.leather_gauntlets, equipment.feet => equipment.leather_greaves, equipment.main_hand => equipment.jade_sword, diff --git a/source/resource.adb b/source/resource.adb index 8092d89..371165d 100644 --- a/source/resource.adb +++ b/source/resource.adb @@ -42,7 +42,7 @@ package body resource is for index in enumeration loop ui.draw_icon (icon (index), trait (index).text, x + 4 * core.icon * enumeration'pos (index), y); ui.draw_frame (trait (index).text, x + 4 * core.icon * enumeration'pos (index) + core.icon, y, 3 * core.icon, core.icon); - ui.write (data (index)'image, x + 4 * core.icon * enumeration'pos (index) + core.icon - 3, y + 6, size => 18); + ui.write (data (index).value'image, x + 4 * core.icon * enumeration'pos (index) + core.icon - 1, y + 6, size => 18); end loop; end draw_points; diff --git a/source/resource.ads b/source/resource.ads index 4f2cbb3..954b591 100644 --- a/source/resource.ads +++ b/source/resource.ads @@ -20,7 +20,8 @@ package resource is text : core.long_string; end record; - type points is array (enumeration) of natural; + type points is array (enumeration) of core.point; + type prices is array (enumeration) of natural; ------------------------------------------------------------------------------------------ diff --git a/source/world.adb b/source/world.adb index 8e08f48..4280779 100644 --- a/source/world.adb +++ b/source/world.adb @@ -5,6 +5,7 @@ with core, ui, resource, equipment, unit, construction, chad, effect; use type core.cursor_code; +use type core.point; package body world is