diff --git a/source/attribute.adb b/source/attribute.adb index 4ed5e4f..b7f51cb 100644 --- a/source/attribute.adb +++ b/source/attribute.adb @@ -53,6 +53,15 @@ package body attribute is end loop; end draw_points; + ------------------------------------------------------------------------------------------ + + procedure save_points (here : in core.io.file_type; data : in points) is + begin + for index in enumeration loop + core.save_point (here, data (index)); + end loop; + end save_points; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end attribute; diff --git a/source/attribute.ads b/source/attribute.ads index f6d01e1..41ea325 100644 --- a/source/attribute.ads +++ b/source/attribute.ads @@ -46,6 +46,8 @@ package attribute is x : in integer := 0; y : in integer := 0); + procedure save_points (here : in core.io.file_type; data : in points); + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end attribute; diff --git a/source/chad.adb b/source/chad.adb index 2c07774..90b14ec 100644 --- a/source/chad.adb +++ b/source/chad.adb @@ -127,6 +127,27 @@ package body chad is core.draw (alice_the_mad, (core.window_width - core.base) / 2, (core.window_height - core.base) / 2); end draw_alice; + ------------------------------------------------------------------------------------------ + + procedure save_value (here : in core.io.file_type; data : in value) is + begin + core.io.write (here, enumeration'pos (data.index)); + core.io.write (here, core.animation'pos (data.state)); + core.io.write (here, data.x); + core.io.write (here, data.y); + -- + core.save_point (here, data.health); + core.save_point (here, data.mana); + core.save_point (here, data.stamina); + -- + attribute.save_points (here, data.attributes); + skill.save_points (here, data.skills); + resource.save_points (here, data.resources); + --~equipments : equipment.equip_array; + --~item_count : natural; + --~items : item_array; + end save_value; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end chad; diff --git a/source/chad.ads b/source/chad.ads index d781e04..5bf8fa0 100644 --- a/source/chad.ads +++ b/source/chad.ads @@ -70,7 +70,7 @@ package chad is procedure draw_pepe; procedure draw_alice; - --~procedure save_value_data (file : in ; data : in value); + procedure save_value (here : in core.io.file_type; data : in value); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/core.adb b/source/core.adb index a0bac0b..aed8a74 100644 --- a/source/core.adb +++ b/source/core.adb @@ -395,6 +395,14 @@ package body core is ------------------------------------------------------------------------------------------ + procedure save_point (here : in io.file_type; data : in point) is + begin + core.io.write (here, data.value); + core.io.write (here, data.limit); + end save_point; + + ------------------------------------------------------------------------------------------ + procedure increment (value : in out integer) is begin value := value + 1; end increment; procedure decrement (value : in out integer) is begin value := value - 1; end decrement; diff --git a/source/core.ads b/source/core.ads index 2da86d7..376b96c 100644 --- a/source/core.ads +++ b/source/core.ads @@ -183,6 +183,8 @@ package core is procedure write_help_box (text : in string); procedure write_text_box (text : in string); + procedure save_point (here : in core.io.file_type; data : in point); + procedure increment (value : in out integer); procedure decrement (value : in out integer); diff --git a/source/resource.adb b/source/resource.adb index 241abb6..e65f92a 100644 --- a/source/resource.adb +++ b/source/resource.adb @@ -51,6 +51,15 @@ package body resource is end loop; end draw_points; + ------------------------------------------------------------------------------------------ + + procedure save_points (here : in core.io.file_type; data : in points) is + begin + for index in enumeration loop + core.save_point (here, data (index)); + end loop; + end save_points; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end resource; diff --git a/source/resource.ads b/source/resource.ads index c4f5987..5df9801 100644 --- a/source/resource.ads +++ b/source/resource.ads @@ -42,6 +42,8 @@ package resource is procedure draw_points (data : in points; x, y : in integer); + procedure save_points (here : in core.io.file_type; data : in points); + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end resource; diff --git a/source/skill.adb b/source/skill.adb index f8cb1fd..7833d25 100644 --- a/source/skill.adb +++ b/source/skill.adb @@ -63,6 +63,15 @@ package body skill is end loop; end draw_points; + ------------------------------------------------------------------------------------------ + + procedure save_points (here : in core.io.file_type; data : in points) is + begin + for index in enumeration loop + core.save_point (here, data (index)); + end loop; + end save_points; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end skill; diff --git a/source/skill.ads b/source/skill.ads index aecbc10..10bb67c 100644 --- a/source/skill.ads +++ b/source/skill.ads @@ -60,6 +60,8 @@ package skill is x : in integer := 0; y : in integer := 0); + procedure save_points (here : in core.io.file_type; data : in points); + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end skill; diff --git a/source/world.adb b/source/world.adb index 94c447e..fd6b586 100644 --- a/source/world.adb +++ b/source/world.adb @@ -204,6 +204,8 @@ package body world is for index in 1 .. equipment_limit loop save_entity (file, map.equipments (index)); end loop; for index in 1 .. unit_limit loop save_entity (file, map.units (index)); end loop; -- + chad.save_value (file, map.chads (1)); + -- core.io.close (file); -- core.echo (core.success, "Saved current map as '" & file_name & "'.");