diff --git a/source/skill.ads b/source/skill.ads index f179b12..2730461 100644 --- a/source/skill.ads +++ b/source/skill.ads @@ -18,7 +18,7 @@ package skill is ------------------------------------------------------------------------------------------ - subtype limit is new natural range 0 .. 7; + subtype limit is natural range 0 .. 7; type definition is record name : access string := new string'("--"); diff --git a/source/world.adb b/source/world.adb index b76fbc8..523c6a8 100644 --- a/source/world.adb +++ b/source/world.adb @@ -503,43 +503,14 @@ package body world is begin ui.draw_frame (x, y, width, height); -- - orient := orient + view_chad_basics (data, x + offset, y + offset, limit - 2 * offset); - ui.draw_separator ( x + offset, y + offset + orient.y, limit - 2 * offset); - orient := orient + view_chad_points (data, x + offset, y + offset + orient.y + core.base, limit - 2 * offset); - ui.draw_separator ( x + offset, y + offset + orient.y + core.base, limit - 2 * offset); + orient := orient + view_chad_basics (data, x + offset, y + offset, limit - 2 * offset); + ui.draw_separator ( x + offset, y + offset + orient.y, limit - 2 * offset); + orient := orient + view_chad_points (data, x + offset, y + offset + orient.y + 1 * core.base, limit - 2 * offset); + ui.draw_separator ( x + offset, y + offset + orient.y + 1 * core.base, limit - 2 * offset); + orient := orient + view_chad_equipment (data, x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); + orient := orient + view_chad_skills (data, x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); + ui.draw_separator ( x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); -- - for index in equipment.kind loop - if equipment_valid (data.equipments (index)) then - ui.draw_overicon (data => equipment.icon (data.equipments (index)), - text => equipment.description (data.equipments (index)).name.all, - x => x + offset + equipment.kind'pos (index) * core.icon, - y => y + offset + 2 * core.base + chad.view_height + 3 * core.icon); - else - ui.draw_overicon (data => equipment.slot (index), - text => "Slot '" & core.lowercase (equipment.kind (index)'image) & "' is empty.", - x => x + offset + equipment.kind'pos (index) * core.icon, - y => y + offset + 2 * core.base + chad.view_height + 3 * core.icon); - end if; - end loop; - -- - ui.draw_text (text => "Equipment", - x => x + offset + 8 * core.icon, - y => y + offset + 2 * core.base + chad.view_height + 3 * core.icon, - width => width - 8 * core.icon - 2 * offset, - height => core.icon, - offset => core.more); - -- - --~at_y := at_y + core.icon; - --~-- - --~ui.draw_text ("Skills", at_x + side, at_y, width - side - 2 * offset, core.icon, core.more); - --~-- - --~for index in 0 .. skill.limit - 1 loop - --~ui.draw_icon (skill.icon (data.skills (index).index), skill.description (data.skills (index).index).text.all, at_x + index * core.icon, at_y); - --~ui.write (data.points (index).value'image, at_x + index * core.icon + core.more, at_y + core.more, code => true); - --~end loop; - --~-- - --~at_y := at_y + core.icon; - --~-- --~ui.draw_separator (at_x, at_y, width - 2 * offset); --~-- --~at_y := at_y + core.base; @@ -703,9 +674,9 @@ package body world is for index in resource.enumeration loop core.save_point (file, map.chads (chad_index).resources (index)); end loop; for index in material.enumeration loop core.save_point (file, map.chads (chad_index).materials (index)); end loop; -- - for index in 0 .. skill.limit - 1 loop core.io.write (file, skill.enumeration'pos (map.chads (chad_index).skills (index).index)); end loop; - for index in 0 .. skill.limit - 1 loop core.io.write (file, map.chads (chad_index).skills (index).value); end loop; - for index in 0 .. skill.limit - 1 loop core.io.write (file, map.chads (chad_index).skills (index).limit); end loop; + for index in skill.limit loop core.io.write (file, skill.enumeration'pos (map.chads (chad_index).skills (index).index)); end loop; + for index in skill.limit loop core.io.write (file, map.chads (chad_index).skills (index).value); end loop; + for index in skill.limit loop core.io.write (file, map.chads (chad_index).skills (index).limit); end loop; -- for kind in equipment.kind loop core.io.write (file, equipment.enumeration'pos (map.chads (chad_index).equipments (kind))); @@ -795,9 +766,9 @@ package body world is for index in resource.enumeration loop core.load_point (file, map.chads (chad_index).resources (index)); end loop; for index in material.enumeration loop core.load_point (file, map.chads (chad_index).materials (index)); end loop; -- - for index in 0 .. skill.limit - 1 loop core.io.read (file, this); map.chads (chad_index).skills (index).index := skill.enumeration'val (this); end loop; - for index in 0 .. skill.limit - 1 loop core.io.read (file, map.chads (chad_index).skills (index).value); end loop; - for index in 0 .. skill.limit - 1 loop core.io.read (file, map.chads (chad_index).skills (index).limit); end loop; + for index in skill.limit loop core.io.read (file, this); map.chads (chad_index).skills (index).index := skill.enumeration'val (this); end loop; + for index in skill.limit loop core.io.read (file, map.chads (chad_index).skills (index).value); end loop; + for index in skill.limit loop core.io.read (file, map.chads (chad_index).skills (index).limit); end loop; -- for kind in equipment.kind loop core.io.read (file, this); map.chads (chad_index).equipments (kind) := equipment.enumeration'val (this); @@ -1223,15 +1194,41 @@ package body world is ------------------------------------------------------------------------------------------ function view_chad_skills (data : in chad.information; x, y, limit : in integer) return core.vector is + count : constant natural := skill.limit'last + 1; + width : constant natural := limit / 2; begin - return (limit, skill.limit * core.icon); + for index in skill.limit loop + ui.draw_icon (data => skill.icon (data.skills (index).index), + text => skill.description (data.skills (index).index).text.all, + x => x + (index mod 2) * width, + y => y + (index / 2) * core.icon); + -- + ui.draw_text (text => skill.description (data.skills (index).index).name.all & data.skills (index).value'image, + x => x + (index mod 2) * width + core.icon, + y => y + (index / 2) * core.icon, + width => width - core.icon, + height => core.icon, + offset => core.more); + end loop; + -- + return (limit, (count / 2) * core.icon); end view_chad_skills; ------------------------------------------------------------------------------------------ function view_chad_equipment (data : in chad.information; x, y, limit : in integer) return core.vector is + count : constant natural := equipment.kind'pos (equipment.kind'last) + 1; begin - return (0, 0); + for index in equipment.kind loop + ui.draw_overicon (data => (if equipment_valid (data.equipments (index)) then equipment.icon (data.equipments (index)) else equipment.slot (index)), + text => (if equipment_valid (data.equipments (index)) then equipment.description (data.equipments (index)).name.all else "--"), + x => x + equipment.kind'pos (index) * core.icon, + y => y); + end loop; + -- + ui.draw_text ("Equipment", x + count * core.icon, y, limit - count * core.icon, core.icon, core.more); + -- + return (limit, core.icon); end view_chad_equipment; ------------------------------------------------------------------------------------------