diff --git a/source/main.adb b/source/main.adb index 4e6ae30..df0a0fe 100644 --- a/source/main.adb +++ b/source/main.adb @@ -6,9 +6,6 @@ pragma ada_2012; with core, ui, effect, attribute, skill, resource, faction, deity, material, magic, equipment, unit, construction, chad, world; -with ada.strings.unbounded; -use ada.strings.unbounded; - use type core.cursor_code; use type core.signal_code; use type core.point; @@ -65,11 +62,11 @@ procedure main is view_icon : array (view) of core.sprite := (others => (others => 0)); view_list : array (view) of boolean := (fullscreen => false, others => true); - view_text : array (view) of core.long_string := ( - "Toggle map preview panel. ", - "Toggle status preview panel. ", - "Toggle text box panel. ", - "Toggle fullscreen or windowed mode. " + view_text : constant array (view) of access string := ( + new string' ("Toggle map preview panel."), + new string' ("Toggle status preview panel."), + new string' ("Toggle text box panel."), + new string' ("Toggle fullscreen or windowed mode.") ); game_title : core.sprite; @@ -78,45 +75,32 @@ procedure main is switch : natural := 0; choose : world.biome := world.grass; - view_source_code : natural := 25; + view_source_code : natural := 17; - source_code : array (0 .. 35) of unbounded_string := ( - to_unbounded_string (core.folder & "/source/ai.adb"), - to_unbounded_string (core.folder & "/source/ai.ads"), - to_unbounded_string (core.folder & "/source/attribute.adb"), - to_unbounded_string (core.folder & "/source/attribute.ads"), - to_unbounded_string (core.folder & "/source/chad.adb"), - to_unbounded_string (core.folder & "/source/chad.ads"), - to_unbounded_string (core.folder & "/source/construction.adb"), - to_unbounded_string (core.folder & "/source/construction.ads"), - to_unbounded_string (core.folder & "/source/core.adb"), - to_unbounded_string (core.folder & "/source/core.ads"), - to_unbounded_string (core.folder & "/source/deity.adb"), - to_unbounded_string (core.folder & "/source/deity.ads"), - to_unbounded_string (core.folder & "/source/effect.adb"), - to_unbounded_string (core.folder & "/source/effect.ads"), - to_unbounded_string (core.folder & "/source/equipment.adb"), - to_unbounded_string (core.folder & "/source/equipment.ads"), - to_unbounded_string (core.folder & "/source/faction.adb"), - to_unbounded_string (core.folder & "/source/faction.ads"), - to_unbounded_string (core.folder & "/source/magic.adb"), - to_unbounded_string (core.folder & "/source/magic.ads"), - to_unbounded_string (core.folder & "/source/main.adb"), - to_unbounded_string (core.folder & "/source/material.adb"), - to_unbounded_string (core.folder & "/source/material.ads"), - to_unbounded_string (core.folder & "/source/might.adb"), - to_unbounded_string (core.folder & "/source/might.ads"), - to_unbounded_string (core.folder & "/source/ray.ads"), - to_unbounded_string (core.folder & "/source/resource.adb"), - to_unbounded_string (core.folder & "/source/resource.ads"), - to_unbounded_string (core.folder & "/source/skill.adb"), - to_unbounded_string (core.folder & "/source/skill.ads"), - to_unbounded_string (core.folder & "/source/ui.adb"), - to_unbounded_string (core.folder & "/source/ui.ads"), - to_unbounded_string (core.folder & "/source/unit.adb"), - to_unbounded_string (core.folder & "/source/unit.ads"), - to_unbounded_string (core.folder & "/source/world.adb"), - to_unbounded_string (core.folder & "/source/world.ads") + source_code : constant array (0 .. 22) of access string := ( + new string' (core.folder & "/source/ai.adb"), + new string' (core.folder & "/source/ai.ads"), + new string' (core.folder & "/source/attribute.ads"), + new string' (core.folder & "/source/chad.ads"), + new string' (core.folder & "/source/construction.ads"), + new string' (core.folder & "/source/core.adb"), + new string' (core.folder & "/source/core.ads"), + new string' (core.folder & "/source/deity.ads"), + new string' (core.folder & "/source/effect.ads"), + new string' (core.folder & "/source/equipment.ads"), + new string' (core.folder & "/source/faction.ads"), + new string' (core.folder & "/source/magic.ads"), + new string' (core.folder & "/source/main.adb"), + new string' (core.folder & "/source/material.ads"), + new string' (core.folder & "/source/might.ads"), + new string' (core.folder & "/source/ray.ads"), + new string' (core.folder & "/source/resource.ads"), + new string' (core.folder & "/source/skill.ads"), + new string' (core.folder & "/source/ui.adb"), + new string' (core.folder & "/source/ui.ads"), + new string' (core.folder & "/source/unit.ads"), + new string' (core.folder & "/source/world.adb"), + new string' (core.folder & "/source/world.ads") ); side_panel : integer := 0; @@ -308,10 +292,10 @@ begin -- declare source_code_data : core.string_box_data; begin - core.import_text (source_code_data, to_string (source_code (view_source_code))); + core.import_text (source_code_data, source_code (view_source_code).all); -- if core.cursor_mode = core.cursor_left then - view_source_code := (view_source_code + 1) mod 36; + view_source_code := (view_source_code + 1) mod 23; core.cursor_mode := core.cursor_none; core.wheel := 0.0; end if; @@ -437,7 +421,7 @@ begin end if; -- for index in view loop - ui.draw_frame (description => view_text (index), + ui.draw_frame (description => view_text (index).all, x => core.window_width - core.icon * (view'pos (view'last) + 1) + core.icon * view'pos (index), y => core.window_height - core.icon, width => core.icon,