From 5d6e67face22284e3c4778a4e3a09fe2cb600007 Mon Sep 17 00:00:00 2001 From: xolatile Date: Tue, 4 Jun 2024 07:28:05 -0400 Subject: [PATCH] Experimenting with static string allocations... --- source/deity.ads | 6 ++-- source/main.adb | 16 +--------- source/material.ads | 61 ++++++++++++++++++----------------- source/world.adb | 6 ++-- source/world.ads | 91 ++++++++++++++++++++++++++--------------------------- 5 files changed, 82 insertions(+), 98 deletions(-) diff --git a/source/deity.ads b/source/deity.ads index a1be6b0..8233405 100644 --- a/source/deity.ads +++ b/source/deity.ads @@ -9,7 +9,7 @@ package deity is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ type enumeration is ( - AEZORA, MITENA, GUAREA, KERENA, ULDRAE, KANAKO, + AEZORA, MITENA, SHEILA, ILIONA, ULDRAE, KANAKO, HENEAL, EVELOR, OROHAN, XORANA ); @@ -31,8 +31,8 @@ package deity is description : constant array (enumeration) of definition := ( AEZORA => ("Aezora ", 0, faction.fairy, attribute.offense, skill.archery, resource.gold), MITENA => ("Mitena ", 0, faction.dwarf, attribute.offense, skill.archery, resource.gold), - GUAREA => ("Guarea ", 0, faction.gnoll, attribute.offense, skill.archery, resource.gold), - KERENA => ("Kerena ", 0, faction.kobold, attribute.offense, skill.archery, resource.gold), + SHEILA => ("Sheila ", 0, faction.gnoll, attribute.offense, skill.archery, resource.gold), + ILIONA => ("Iliona ", 0, faction.kobold, attribute.offense, skill.archery, resource.gold), ULDRAE => ("Uldrae ", 0, faction.goblin, attribute.offense, skill.archery, resource.gold), KANAKO => ("Kanako ", 0, faction.imp, attribute.offense, skill.archery, resource.gold), HENEAL => ("Heneal ", 0, faction.human, attribute.offense, skill.archery, resource.gold), diff --git a/source/main.adb b/source/main.adb index 6cdca4d..0eb6966 100644 --- a/source/main.adb +++ b/source/main.adb @@ -163,20 +163,6 @@ procedure main is procedure zoom_in is begin core.zoom := 2; end zoom_in; procedure zoom_out is begin core.zoom := 1; end zoom_out; - ------------------------------------------------------------------------------------------ - - --~procedure main_menu is - --~begin - --~core.draw (game_preview (world.ash), core.center_x (game_preview (world.ash).width * 2), core.center_y (game_preview (world.ash).height * 2), factor => 2); - --~core.draw (game_title, core.center_x (game_title.width * 2), core.center_y (game_title.height * 2), factor => 2); - --~-- - --~ui.write ("Main Menu", 0, 0); - --~-- - --~ui.draw_check_box (0, 32, view_list (map_preview_panel), "map_preview_panel"); - --~ui.draw_check_box (0, 64, view_list (status_preview_panel), "status_preview_panel"); - --~ui.draw_check_box (0, 96, view_list (text_box_panel), "text_box_panel"); - --~end main_menu; - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ begin @@ -479,7 +465,7 @@ begin begin for index in material.enumeration loop if world.map.chads (1).materials (index).value > 0 then - ui.draw_icon (material.icon (index), -(material.description (index).name), move_x, core.base + core.icon); + ui.draw_icon (material.icon (index), material.description (index).name.all, move_x, core.base + core.icon); ui.draw_text_box (move_x, core.base + core.icon + core.icon, core.icon, core.icon); ui.write (world.map.chads (1).materials (index).value'image, move_x, core.base + core.icon + core.icon + 8, (255, 255, 255, 255), 15, true); -- diff --git a/source/material.ads b/source/material.ads index 80bb924..ece10d5 100644 --- a/source/material.ads +++ b/source/material.ads @@ -3,7 +3,6 @@ -- GNU General Public Licence (version 3 or later) with core; -use core; package material is @@ -20,8 +19,8 @@ package material is ------------------------------------------------------------------------------------------ type definition is record - name : core.unstring; - cost : natural; + name : access string; + cost : natural; end record; type points is array (enumeration) of core.point; @@ -33,34 +32,34 @@ package material is default : constant points := (others => (1, 12)); description : constant array (enumeration) of definition := ( - sulphur => (+("Sulphur"), 11), - mercury => (+("Mercury"), 13), - mint => (+("Mint"), 3), - cinnamon => (+("Cinnamon"), 5), - apple => (+("Apple"), 2), - peach => (+("Peach"), 2), - pear => (+("Pear"), 2), - banana => (+("Banana"), 3), - orange => (+("Orange"), 3), - plum => (+("Plum"), 3), - cherry => (+("Cherry"), 3), - lemon => (+("Lemon"), 2), - potato => (+("Potato"), 1), - wheat => (+("Wheat"), 1), - carrot => (+("Carrot"), 2), - cucumber => (+("Cucumber"), 3), - onion => (+("Onion"), 2), - garlic => (+("Garlic"), 2), - eggplant => (+("Eggplant"), 3), - tomato => (+("Tomato"), 2), - meat => (+("Meat"), 3), - fish_meat => (+("Fish Meat"), 2), - skull => (+("Skull"), 1), - animal_skull => (+("Animal Skull"), 1), - bone => (+("Bone"), 1), - rib_cage => (+("Rib Cage"), 1), - animal_skin => (+("Animal Skin"), 5), - animal_fur => (+("Animal Fur"), 7) + sulphur => (new string' ("Sulphur"), 11), + mercury => (new string' ("Mercury"), 13), + mint => (new string' ("Mint"), 3), + cinnamon => (new string' ("Cinnamon"), 5), + apple => (new string' ("Apple"), 2), + peach => (new string' ("Peach"), 2), + pear => (new string' ("Pear"), 2), + banana => (new string' ("Banana"), 3), + orange => (new string' ("Orange"), 3), + plum => (new string' ("Plum"), 3), + cherry => (new string' ("Cherry"), 3), + lemon => (new string' ("Lemon"), 2), + potato => (new string' ("Potato"), 1), + wheat => (new string' ("Wheat"), 1), + carrot => (new string' ("Carrot"), 2), + cucumber => (new string' ("Cucumber"), 3), + onion => (new string' ("Onion"), 2), + garlic => (new string' ("Garlic"), 2), + eggplant => (new string' ("Eggplant"), 3), + tomato => (new string' ("Tomato"), 2), + meat => (new string' ("Meat"), 3), + fish_meat => (new string' ("Fish Meat"), 2), + skull => (new string' ("Skull"), 1), + animal_skull => (new string' ("Animal Skull"), 1), + bone => (new string' ("Bone"), 1), + rib_cage => (new string' ("Rib Cage"), 1), + animal_skin => (new string' ("Animal Skin"), 5), + animal_fur => (new string' ("Animal Fur"), 7) ); icon : array (enumeration) of core.sprite; diff --git a/source/world.adb b/source/world.adb index ec79dca..91d8a1d 100644 --- a/source/world.adb +++ b/source/world.adb @@ -238,7 +238,7 @@ package body world is height => landmarks (landmark_index'val (map.landmarks (index).index)).height) and core.cursor_mode = core.cursor_middle and not ui.prioritize then - core.write_text_box (landmark_description (landmark_index'val (map.landmarks (index).index)).name); + core.write_text_box (-(landmark_description (landmark_index'val (map.landmarks (index).index)).name)); end if; end if; end loop; @@ -271,7 +271,7 @@ package body world is height => locations (location_index'val (map.locations (index).index)).height) and core.cursor_mode = core.cursor_middle and not ui.prioritize then - core.write_text_box (location_description (location_index'val (map.locations (index).index)).name); + core.write_text_box (-(location_description (location_index'val (map.locations (index).index)).name)); end if; end if; -- @@ -316,7 +316,7 @@ package body world is -- when effect.modify_material => material_index := material.enumeration'val (data.modifier); player.materials (material_index) := player.materials (material_index) + data.amount; - ui.echo ("+" & data.amount'image & " " & (-(material.description (material_index).name))); + ui.echo ("+" & data.amount'image & " " & material.description (material_index).name.all); end case; end; -- diff --git a/source/world.ads b/source/world.ads index fc97c2b..770aa9b 100644 --- a/source/world.ads +++ b/source/world.ads @@ -31,14 +31,14 @@ package world is ------------------------------------------------------------------------------------------ type landmark_stats is record - name : core.short_string; + name : core.unstring; spawn : biome; clip : boolean; frames : integer; end record; type location_stats is record - name : core.short_string; + name : core.unstring; clip : boolean; frames : integer; states : integer; @@ -83,51 +83,50 @@ package world is location_count : constant natural := location_index'pos (location_index'last) + 1; landmark_description : constant array (landmark_index) of landmark_stats := ( - dead_tree => ("Dead Tree ", ash, true, 1), - mossy_rock => ("Mossy Rock ", swamp, true, 1), - palm_tree => ("Palm Tree ", sand, true, 4), - pine_tree => ("Pine Tree ", grass, true, 4), - pine_forest => ("Pine Forest ", grass, true, 4), - reeds => ("Reeds ", swamp, false, 4), - rock => ("Rock ", sand, true, 1), - snowed_pine_tree => ("Snowed Pine Tree ", snow, true, 4), - snowed_rock => ("Snowed Rock ", snow, true, 1), - spiky_rock => ("Spiky Rock ", ash, true, 1), - wooden_sign => ("Wooden Sign ", grass, false, 1), - wooden_arrow_sign => ("Wooden Arrow Sign ", grass, false, 1), - rune_stone => ("Rune Stone ", grass, true, 4), - snowed_rune_stone => ("Snowed Rune Stone ", snow, true, 1), - mossy_rune_stone => ("Mossy Rune Stone ", swamp, true, 4), - snowed_pine_forest => ("Snowed Pine Forest ", snow, true, 4), - hyacinths => ("Hyacinths ", grass, false, 1), - orchids => ("Orchids ", grass, false, 1), - asters => ("Asters ", grass, false, 1), - daffodils => ("Daffodils ", grass, false, 1), - royal_grave => ("Royal Grave ", ash, true, 1), - grave => ("Grave ", ash, true, 1), - humble_grave => ("Humble Grave ", ash, true, 1), - wooden_wide_sign => ("Wooden Wide Sign ", grass, false, 1), - birch_tree => ("Birch Tree ", grass, true, 4), - fir_tree => ("Fir Tree ", grass, true, 4), - oak_tree => ("Oak Tree ", grass, true, 4), - old_willow_tree => ("Old Willow Tree ", swamp, true, 4) + dead_tree => (+("Dead Tree"), ash, true, 1), + mossy_rock => (+("Mossy Rock"), swamp, true, 1), + palm_tree => (+("Palm Tree"), sand, true, 4), + pine_tree => (+("Pine Tree"), grass, true, 4), + pine_forest => (+("Pine Forest"), grass, true, 4), + reeds => (+("Reeds"), swamp, false, 4), + rock => (+("Rock"), sand, true, 1), + snowed_pine_tree => (+("Snowed Pine Tree"), snow, true, 4), + snowed_rock => (+("Snowed Rock"), snow, true, 1), + spiky_rock => (+("Spiky Rock"), ash, true, 1), + wooden_sign => (+("Wooden Sign"), grass, false, 1), + wooden_arrow_sign => (+("Wooden Arrow Sign"), grass, false, 1), + rune_stone => (+("Rune Stone"), grass, true, 4), + snowed_rune_stone => (+("Snowed Rune Stone"), snow, true, 1), + mossy_rune_stone => (+("Mossy Rune Stone"), swamp, true, 4), + snowed_pine_forest => (+("Snowed Pine Forest"), snow, true, 4), + hyacinths => (+("Hyacinths"), grass, false, 1), + orchids => (+("Orchids"), grass, false, 1), + asters => (+("Asters"), grass, false, 1), + daffodils => (+("Daffodils"), grass, false, 1), + royal_grave => (+("Royal Grave"), ash, true, 1), + grave => (+("Grave"), ash, true, 1), + humble_grave => (+("Humble Grave"), ash, true, 1), + wooden_wide_sign => (+("Wooden Wide Sign"), grass, false, 1), + birch_tree => (+("Birch Tree"), grass, true, 4), + fir_tree => (+("Fir Tree"), grass, true, 4), + oak_tree => (+("Oak Tree"), grass, true, 4), + old_willow_tree => (+("Old Willow Tree"), swamp, true, 4) ); location_description : constant array (location_index) of location_stats := ( - well_of_agility => ("Well of Agility ", true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.speed), 2, false, 0)), - well_of_knowledge => ("Well of Knowledge ", true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.wisdom), 2, false, 0)), - well_of_strength => ("Well of Strength ", true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 2, false, 0)), - old_dwarven_grave => ("Old Dwarven Grave ", true, 1, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.defense), 1, false, 0)), - huge_ancient_urn => ("Huge Ancient Urn ", true, 1, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 1, false, 0)), - -- - banana_tree => ("Banana Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.banana), 4, true, 600)), - apple_tree => ("Apple Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.apple), 6, true, 600)), - cherry_tree => ("Cherry Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.cherry), 6, true, 600)), - lemon_tree => ("Lemon Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.lemon), 6, true, 600)), - orange_tree => ("Orange Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.orange), 6, true, 600)), - pear_tree => ("Pear Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.pear), 6, true, 600)), - peach_tree => ("Peach Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.peach), 6, true, 600)), - plum_tree => ("Plum Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.plum), 6, true, 600)) + well_of_agility => (+("Well of Agility"), true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.speed), 2, false, 0)), + well_of_knowledge => (+("Well of Knowledge"), true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.wisdom), 2, false, 0)), + well_of_strength => (+("Well of Strength"), true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 2, false, 0)), + old_dwarven_grave => (+("Old Dwarven Grave"), true, 1, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.defense), 1, false, 0)), + huge_ancient_urn => (+("Huge Ancient Urn"), true, 1, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 1, false, 0)), + banana_tree => (+("Banana Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.banana), 4, true, 600)), + apple_tree => (+("Apple Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.apple), 6, true, 600)), + cherry_tree => (+("Cherry Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.cherry), 6, true, 600)), + lemon_tree => (+("Lemon Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.lemon), 6, true, 600)), + orange_tree => (+("Orange Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.orange), 6, true, 600)), + pear_tree => (+("Pear Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.pear), 6, true, 600)), + peach_tree => (+("Peach Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.peach), 6, true, 600)), + plum_tree => (+("Plum Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.plum), 6, true, 600)) ); month_name : constant array (1 .. 12) of core.unstring := ( @@ -138,8 +137,8 @@ package world is +("V <> Month of Orohan"), +("VI <> Month of Aezora"), +("VII <> Month of Mitena"), - +("VIII <> Month of Guarea"), - +("IX <> Month of Kerena"), + +("VIII <> Month of Sheila"), + +("IX <> Month of Iliona"), +("X <> Month of Uldrae"), +("XI <> Month of Kanako"), +("XII <> Month of Time-Rebirth")