From 371fbcb04d7c5830f1bef613e9d80d765638a664 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Thu, 29 Feb 2024 12:03:27 +0100 Subject: [PATCH 1/6] Adding a great, simple and standalone small vector. --- .gitmodules | 3 +++ external/svector | 1 + 2 files changed, 4 insertions(+) create mode 160000 external/svector diff --git a/.gitmodules b/.gitmodules index 4256800..7e95e64 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "external/ImFileDialog"] path = external/ImFileDialog url = https://github.com/dfranx/ImFileDialog.git +[submodule "external/svector"] + path = external/svector + url = https://github.com/martinus/svector.git diff --git a/external/svector b/external/svector new file mode 160000 index 0000000..74817cf --- /dev/null +++ b/external/svector @@ -0,0 +1 @@ +Subproject commit 74817cfbdbaceb415508de1ff10a0589bf8f25d7 From 7ee5899e3160edc7f7e3b6c5788c646af9bf7138 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Thu, 29 Feb 2024 12:04:09 +0100 Subject: [PATCH 2/6] Reformat Reformat --- CMakeLists.txt | 16 ++-- include/billy_objects.hpp | 39 +++++----- include/character_sheet.hpp | 2 + include/characteristic/characteristic.hpp | 6 +- include/gui/menu/menu_data.hpp | 4 +- src/billy_objects.cpp | 93 +++++++++++------------ src/gui/gui.cpp | 41 +++++----- src/gui/menu/menu.cpp | 8 +- src/gui/window.cpp | 10 +-- 9 files changed, 111 insertions(+), 108 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6098595..627f40e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,11 +129,8 @@ target_compile_definitions(BillySheet PRIVATE $<$:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG> $<$:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_ERROR>) -target_compile_definitions(spdlog PRIVATE - $<$:_GLIBCXX_DEBUG>) - -target_compile_definitions(glfw PRIVATE - $<$:_GLIBCXX_DEBUG>) +target_compile_definitions(spdlog PRIVATE $<$:_GLIBCXX_DEBUG>) +target_compile_definitions(glfw PRIVATE $<$:_GLIBCXX_DEBUG>) target_compile_options(spdlog PRIVATE ${COMPILE_FLAGS}) target_compile_options(glfw PRIVATE ${COMPILE_FLAGS}) @@ -145,4 +142,11 @@ target_link_options(BillySheet PRIVATE ${LINKER_OPTIONS}) target_link_libraries(spdlog PRIVATE ${LINKER_FLAGS}) target_link_libraries(glfw PRIVATE ${LINKER_FLAGS}) -target_link_libraries(BillySheet glfw spdlog::spdlog_header_only OpenGL::OpenGL GLEW::GLEW nlohmann_json::nlohmann_json ${Boost_LIBRARIES} ${LINKER_FLAGS}) +target_link_libraries(BillySheet glfw + spdlog::spdlog_header_only + OpenGL::OpenGL + GLEW::GLEW + nlohmann_json::nlohmann_json + ${Boost_LIBRARIES} + ${LINKER_FLAGS} +) diff --git a/include/billy_objects.hpp b/include/billy_objects.hpp index 7b4b95b..fddfa07 100644 --- a/include/billy_objects.hpp +++ b/include/billy_objects.hpp @@ -81,31 +81,28 @@ namespace character { std::uint8_t end_object{ 0 }; static void change_carac_weapon(const weapons &arg, - CharacterSheet &sheet, - characteristic::Characteristic &localHabilete, - characteristic::Characteristic &localAdresse, - characteristic::Characteristic &localEndurance, - const std::function &operation) noexcept; + CharacterSheet &sheet, + characteristic::Characteristic &localHabilete, + characteristic::Characteristic &localAdresse, + characteristic::Characteristic &localEndurance, + const std::function &operation) noexcept; static void change_carac_equipment(const equipments &arg, - CharacterSheet &sheet, - characteristic::Characteristic &localHabilete, - characteristic::Characteristic &localAdresse, - characteristic::Characteristic &localEndurance, - characteristic::Characteristic &localChance, - const std::function &primary, - const std::function &complement) noexcept; + CharacterSheet &sheet, + characteristic::Characteristic &localHabilete, + characteristic::Characteristic &localAdresse, + characteristic::Characteristic &localEndurance, + characteristic::Characteristic &localChance, + const std::function &primary, + const std::function &complement) noexcept; static void change_carac_tools(const tools &arg, - CharacterSheet &sheet, - characteristic::Characteristic &localHabilete, - characteristic::Characteristic &localAdresse, - characteristic::Characteristic &localEndurance, - characteristic::Characteristic &localChance, - const std::function &operation) noexcept; + CharacterSheet &sheet, + characteristic::Characteristic &localHabilete, + characteristic::Characteristic &localAdresse, + characteristic::Characteristic &localEndurance, + characteristic::Characteristic &localChance, + const std::function &operation) noexcept; }; } diff --git a/include/character_sheet.hpp b/include/character_sheet.hpp index b19ce82..cd608b9 100644 --- a/include/character_sheet.hpp +++ b/include/character_sheet.hpp @@ -45,6 +45,8 @@ namespace character { std::uint32_t damage{ 0 }; + std::uint32_t critique{ 0 }; + std::uint32_t glory{ 0 }; std::uint32_t money{ 0 }; diff --git a/include/characteristic/characteristic.hpp b/include/characteristic/characteristic.hpp index d52479c..d41000f 100644 --- a/include/characteristic/characteristic.hpp +++ b/include/characteristic/characteristic.hpp @@ -25,9 +25,9 @@ namespace character::characteristic { Characteristic() noexcept = default; Characteristic(const std::uint32_t base, - const std::uint32_t carac, - const std::uint32_t materiel, - const std::uint32_t additional) noexcept: + const std::uint32_t carac, + const std::uint32_t materiel, + const std::uint32_t additional) noexcept: base(base), carac(carac), materiel(materiel), additional(additional) { (void) get_total(); } Characteristic(const Characteristic &charac) noexcept = default; diff --git a/include/gui/menu/menu_data.hpp b/include/gui/menu/menu_data.hpp index d40bc1f..883a316 100644 --- a/include/gui/menu/menu_data.hpp +++ b/include/gui/menu/menu_data.hpp @@ -37,10 +37,10 @@ namespace gui::menu { [[nodiscard]] bool is_edit_mode() const { return edit_mode; } void set_save_path([[maybe_unused]] const Controller &controller, - const fs::path &savePath) const { save_path = savePath; } + const fs::path &savePath) const { save_path = savePath; } void set_filename([[maybe_unused]] const Controller &controller, - const std::string &fileName) const { filename = fileName; } + const std::string &fileName) const { filename = fileName; } }; } diff --git a/src/billy_objects.cpp b/src/billy_objects.cpp index dd69c23..30d2258 100644 --- a/src/billy_objects.cpp +++ b/src/billy_objects.cpp @@ -26,23 +26,23 @@ namespace character { [&](const equipments &arg) { ++sheet.nb_equipments; change_carac_equipment(arg, - sheet, - local_habilete, - local_adresse, - local_endurance, - local_chance, - plus, - minus); + sheet, + local_habilete, + local_adresse, + local_endurance, + local_chance, + plus, + minus); }, [&](const tools &arg) { ++sheet.nb_tools; change_carac_tools(arg, - sheet, - local_habilete, - local_adresse, - local_endurance, - local_chance, - plus); + sheet, + local_habilete, + local_adresse, + local_endurance, + local_chance, + plus); }, }, object); } @@ -66,36 +66,35 @@ namespace character { [&](const equipments &arg) { --sheet.nb_equipments; change_carac_equipment(arg, - sheet, - local_habilete, - local_adresse, - local_endurance, - local_chance, - minus, - plus); + sheet, + local_habilete, + local_adresse, + local_endurance, + local_chance, + minus, + plus); }, [&](const tools &arg) { --sheet.nb_tools; change_carac_tools(arg, - sheet, - local_habilete, - local_adresse, - local_endurance, - local_chance, - minus); + sheet, + local_habilete, + local_adresse, + local_endurance, + local_chance, + minus); } }, obj); } } void BillyObjects::change_carac_tools(const tools &arg, - CharacterSheet &sheet, - Characteristic &localHabilete, - Characteristic &localAdresse, - Characteristic &localEndurance, - Characteristic &localChance, - const std::function &operation) noexcept { + CharacterSheet &sheet, + Characteristic &localHabilete, + Characteristic &localAdresse, + Characteristic &localEndurance, + Characteristic &localChance, + const std::function &operation) noexcept { switch (arg) { case tools::Fourche: localHabilete.materiel = operation(localHabilete.materiel, 1); @@ -114,14 +113,14 @@ namespace character { } void BillyObjects::change_carac_equipment(const equipments &arg, - CharacterSheet &sheet, - Characteristic &localHabilete, - Characteristic &localAdresse, - Characteristic &localEndurance, - Characteristic &localChance, - const std::function &primary, - const std::function &complement) noexcept { + CharacterSheet &sheet, + Characteristic &localHabilete, + Characteristic &localAdresse, + Characteristic &localEndurance, + Characteristic &localChance, + const std::function &primary, + const std::function &complement) noexcept { switch (arg) { case equipments::Chainmail: localHabilete.materiel = complement(localHabilete.materiel, 1); @@ -143,12 +142,12 @@ namespace character { } void BillyObjects::change_carac_weapon(const weapons &arg, - CharacterSheet &sheet, - Characteristic &localHabilete, - Characteristic &localAdresse, - Characteristic &localEndurance, - const std::function &operation) noexcept { + CharacterSheet &sheet, + Characteristic &localHabilete, + Characteristic &localAdresse, + Characteristic &localEndurance, + const std::function &operation) noexcept { switch (arg) { case weapons::Sword: localHabilete.materiel = operation(localHabilete.materiel, 4); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 62a65ae..32f3f77 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -53,13 +53,14 @@ void gui::Gui::render_gui(const Controller &controller) { menu.gui(); if (ImGui::BeginCombo("Classe", - GuiData::classes[static_cast(data.billy.get_current_class())].data(), - ImGuiComboFlags_PopupAlignLeft)) { + GuiData::classes[static_cast(data.billy.get_current_class())].data(), + ImGuiComboFlags_PopupAlignLeft)) { for (std::size_t i = 0; i < GuiData::classes.size(); ++i) { const bool is_selected = (data.billy.get_current_class() == static_cast(i)); - if (is_selected) + if (is_selected) { ImGui::SetItemDefaultFocus(); + } } ImGui::EndCombo(); } @@ -131,8 +132,8 @@ void gui::Gui::characteristic_gui(const Characteristic &characteristic) noexcept void gui::Gui::habilete_menu() noexcept { ImGui::BeginChild("habilete", - ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), - ImGuiChildFlags_Border); + ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), + ImGuiChildFlags_Border); ImGui::Text("Habileté"); characteristic_gui(static_cast(data.billy.get_habilete())); ImGui::EndChild(); @@ -140,8 +141,8 @@ void gui::Gui::habilete_menu() noexcept { void gui::Gui::adresse_menu() noexcept { ImGui::BeginChild("adresse", - ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), - ImGuiChildFlags_Border); + ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), + ImGuiChildFlags_Border); ImGui::Text("Adresse"); characteristic_gui(static_cast(data.billy.get_adresse())); ImGui::EndChild(); @@ -149,8 +150,8 @@ void gui::Gui::adresse_menu() noexcept { void gui::Gui::endurance_menu() noexcept { ImGui::BeginChild("endurance", - ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), - ImGuiChildFlags_Border); + ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), + ImGuiChildFlags_Border); ImGui::Text("Endurance"); characteristic_gui(static_cast(data.billy.get_endurance())); ImGui::EndChild(); @@ -158,25 +159,25 @@ void gui::Gui::endurance_menu() noexcept { void gui::Gui::chance_menu() noexcept { ImGui::BeginChild("chance", - ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), - ImGuiChildFlags_Border); + ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), + ImGuiChildFlags_Border); ImGui::Text("Chance"); - characteristic_gui(static_cast(data.billy.get_chance())); + characteristic_gui(static_cast(data.billy.get_chance())); ImGui::EndChild(); } void gui::Gui::stat_second_menu() noexcept { ImGui::BeginChild("stats secondaire", - ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.4f), - ImGuiChildFlags_Border); + ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.4f), + ImGuiChildFlags_Border); ImGui::Text("STAT. SECONDAIRES"); ImGui::EndChild(); } void gui::Gui::materiel_menu() noexcept { ImGui::BeginChild("materiel", - ImVec2(ImGui::GetWindowWidth() / 3, 0), - ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY); + ImVec2(ImGui::GetWindowWidth() / 3, 0), + ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY); ImGui::Text("Matériel"); ImGui::BeginChild("weapons", ImVec2(0, 0), ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY); @@ -205,16 +206,16 @@ void gui::Gui::materiel_menu() noexcept { void gui::Gui::gloire_menu() noexcept { ImGui::BeginChild("gloire", - ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f), - ImGuiChildFlags_Border); + ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f), + ImGuiChildFlags_Border); ImGui::Text("Gloire"); ImGui::EndChild(); } void gui::Gui::richesse_menu() noexcept { ImGui::BeginChild("richesse", - ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f), - ImGuiChildFlags_Border); + ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f), + ImGuiChildFlags_Border); ImGui::Text("Richesse"); ImGui::EndChild(); } diff --git a/src/gui/menu/menu.cpp b/src/gui/menu/menu.cpp index 3c79fd7..d057959 100644 --- a/src/gui/menu/menu.cpp +++ b/src/gui/menu/menu.cpp @@ -41,8 +41,8 @@ void gui::menu::Menu::gui() const noexcept { if (ImGui::MenuItem("Open file")) { SPDLOG_DEBUG("Opening file"); ifd::FileDialog::Instance().Open(data.open_character_key, - "Open a character sheet", - "Character sheet (*.json){.json},.*"); + "Open a character sheet", + "Character sheet (*.json){.json},.*"); SPDLOG_DEBUG("File opened"); } @@ -57,8 +57,8 @@ void gui::menu::Menu::gui() const noexcept { if (ImGui::MenuItem("Save as...")) { SPDLOG_DEBUG("Saving with file dialog"); ifd::FileDialog::Instance().Save(data.save_character_key, - "Save character sheet as...", - "*.json {.json}"); + "Save character sheet as...", + "*.json {.json}"); SPDLOG_DEBUG("File saved with dialog"); } diff --git a/src/gui/window.cpp b/src/gui/window.cpp index ade8de1..5f8cbe9 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -21,11 +21,11 @@ gui::Window::Window() { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); wwindow = std::unique_ptr(glfwCreateWindow(720, - 1280, - "Billy Sheet tracker", - nullptr, - nullptr), - delete_glfw_window); + 1280, + "Billy Sheet tracker", + nullptr, + nullptr), + delete_glfw_window); if (!wwindow) { glfwTerminate(); SPDLOG_CRITICAL("No GLFW window created, nullptr."); From fc37d107e0580a3afc90e43b8ad219caed456743 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Thu, 29 Feb 2024 12:13:43 +0100 Subject: [PATCH 3/6] Adding svector --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 627f40e..35d1f50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,8 @@ else () message(STATUS "ccache not found") endif () +add_subdirectory(external/svector) + option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) @@ -104,7 +106,7 @@ add_executable(BillySheet ${SOURCES}) target_include_directories(BillySheet PRIVATE include include/imgui external/ImFileDialog) -set_target_properties(BillySheet spdlog PROPERTIES +set_target_properties(BillySheet spdlog svector PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF @@ -112,7 +114,7 @@ set_target_properties(BillySheet spdlog PROPERTIES # UNITY_BUILD ON ) -set_target_properties(spdlog PROPERTIES UNITY_BUILD ON) +set_target_properties(spdlog svector PROPERTIES UNITY_BUILD ON) set_target_properties(glfw PROPERTIES C_STANDARD 11 @@ -130,20 +132,25 @@ target_compile_definitions(BillySheet PRIVATE $<$:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_ERROR>) target_compile_definitions(spdlog PRIVATE $<$:_GLIBCXX_DEBUG>) +target_compile_definitions(svector INTERFACE $<$:_GLIBCXX_DEBUG>) target_compile_definitions(glfw PRIVATE $<$:_GLIBCXX_DEBUG>) target_compile_options(spdlog PRIVATE ${COMPILE_FLAGS}) +target_compile_options(svector INTERFACE ${COMPILE_FLAGS}) target_compile_options(glfw PRIVATE ${COMPILE_FLAGS}) target_compile_options(BillySheet PRIVATE ${COMPILE_FLAGS}) target_link_options(spdlog PRIVATE ${LINKER_OPTIONS}) +target_link_options(svector INTERFACE ${LINKER_OPTIONS}) target_link_options(glfw PRIVATE ${LINKER_OPTIONS}) target_link_options(BillySheet PRIVATE ${LINKER_OPTIONS}) target_link_libraries(spdlog PRIVATE ${LINKER_FLAGS}) +target_link_libraries(svector INTERFACE ${LINKER_FLAGS}) target_link_libraries(glfw PRIVATE ${LINKER_FLAGS}) target_link_libraries(BillySheet glfw spdlog::spdlog_header_only + svector::svector OpenGL::OpenGL GLEW::GLEW nlohmann_json::nlohmann_json From 6e50ef7fb8b7ba92bf0b951db70f0af044115675 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Thu, 29 Feb 2024 12:13:57 +0100 Subject: [PATCH 4/6] Deleting useless line --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35d1f50..37301d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,7 +124,6 @@ set_target_properties(glfw PROPERTIES UNITY_BUILD ON ) -set_target_properties(spdlog PROPERTIES UNITY_BUILD ON) target_compile_definitions(BillySheet PRIVATE $<$:_GLIBCXX_DEBUG> From e6bec5c0f24c23756b264f36678f1b81f8e3fda3 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Thu, 29 Feb 2024 12:23:16 +0100 Subject: [PATCH 5/6] Reformat correctly --- src/billy_objects.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/billy_objects.cpp b/src/billy_objects.cpp index 30d2258..36c2bb7 100644 --- a/src/billy_objects.cpp +++ b/src/billy_objects.cpp @@ -119,8 +119,7 @@ namespace character { Characteristic &localEndurance, Characteristic &localChance, const std::function &primary, - const std::function &complement) noexcept { + const std::function &complement) noexcept { switch (arg) { case equipments::Chainmail: localHabilete.materiel = complement(localHabilete.materiel, 1); @@ -146,8 +145,7 @@ namespace character { Characteristic &localHabilete, Characteristic &localAdresse, Characteristic &localEndurance, - const std::function &operation) noexcept { + const std::function &operation) noexcept { switch (arg) { case weapons::Sword: localHabilete.materiel = operation(localHabilete.materiel, 4); From a164593cd85e7159929a4a530df1634b6eadc3ff Mon Sep 17 00:00:00 2001 From: Pcornat Date: Thu, 29 Feb 2024 12:23:30 +0100 Subject: [PATCH 6/6] Using svector --- include/billy_objects.hpp | 8 +++----- src/billy_objects.cpp | 11 +++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/billy_objects.hpp b/include/billy_objects.hpp index fddfa07..5b9b9c7 100644 --- a/include/billy_objects.hpp +++ b/include/billy_objects.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "characteristic/characteristic.hpp" // helper type for the visitor @@ -45,7 +46,7 @@ namespace character { class BillyObjects final { public: using billyObject = std::variant; - using container = std::array; + using container = ankerl::svector; static constexpr std::string_view sword{ "Sword" }; static constexpr std::string_view lance{ "Lance" }; @@ -68,9 +69,7 @@ namespace character { void pop_object(CharacterSheet &sheet) noexcept; - [[nodiscard]] std::pair get_objects() const noexcept { - return { objects, end_object }; - } + [[nodiscard]] const container &get_objects() const noexcept { return objects; } // void insert_weapon(weapons weapon, CharacterSheet &sheet) noexcept; @@ -78,7 +77,6 @@ namespace character { container objects; std::plus plus; std::minus minus; - std::uint8_t end_object{ 0 }; static void change_carac_weapon(const weapons &arg, CharacterSheet &sheet, diff --git a/src/billy_objects.cpp b/src/billy_objects.cpp index 36c2bb7..ad4146e 100644 --- a/src/billy_objects.cpp +++ b/src/billy_objects.cpp @@ -9,9 +9,8 @@ namespace character { using characteristic::Characteristic; void BillyObjects::push_object(const billyObject &object, CharacterSheet &sheet) noexcept { - if (end_object < 3) { - objects.at(end_object) = object; - ++end_object; + if (objects.size() < 3) { + objects.emplace_back(object); auto &local_habilete = static_cast(sheet.habilete); auto &local_adresse = static_cast(sheet.adresse); @@ -49,9 +48,9 @@ namespace character { } void BillyObjects::pop_object(CharacterSheet &sheet) noexcept { - if (end_object > 0) { - const auto &obj = objects.at(end_object - 1); - --end_object; + if (!objects.empty()) { + const billyObject obj = objects.back(); + objects.pop_back(); auto &local_habilete = static_cast(sheet.habilete); auto &local_adresse = static_cast(sheet.adresse);