Using points, work in progress...

This commit is contained in:
Ognjen Milan Robovic 2024-05-23 02:58:30 -04:00
parent fc6d0c44f2
commit f65c8c252f
6 changed files with 11 additions and 9 deletions

View File

@ -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;

View File

@ -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 "/";

View File

@ -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,

View File

@ -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;

View File

@ -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;
------------------------------------------------------------------------------------------

View File

@ -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