From 32b031f734a96f59ee66e2d1d47a7e898bd8d2d6 Mon Sep 17 00:00:00 2001 From: cdemeyer-teachx Date: Thu, 21 Aug 2025 09:50:16 +0900 Subject: [PATCH] main.cpp --- include/core/types.h | 2 ++ src/core/types.cpp | 44 ++++++++++++++++++++------------------------ src/main.cpp | 16 ++++++++++++++++ 3 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 src/main.cpp diff --git a/include/core/types.h b/include/core/types.h index b852c3a..58a8fad 100644 --- a/include/core/types.h +++ b/include/core/types.h @@ -116,6 +116,8 @@ inline const std::span TypeUtils::getTypeChart() { return s_typeChart[static_cast(Gen)]; } +void initializeTypeCharts(); + } // namespace PokEng #endif // POKEMON_m_typesH diff --git a/src/core/types.cpp b/src/core/types.cpp index 35428dd..a64daf5 100644 --- a/src/core/types.cpp +++ b/src/core/types.cpp @@ -254,34 +254,30 @@ std::span getDuplicateTypeChart(const std::array(Generation::I)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-i.json")); - TypeUtils::s_typeChart[static_cast(Generation::II)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-ii.json")); - TypeUtils::s_typeChart[static_cast(Generation::III)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-iii.json")); - TypeUtils::s_typeChart[static_cast(Generation::IV)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-iv.json")); - TypeUtils::s_typeChart[static_cast(Generation::V)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-v.json")); - TypeUtils::s_typeChart[static_cast(Generation::VI)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-vi.json")); - TypeUtils::s_typeChart[static_cast(Generation::VII)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-vii.json")); - TypeUtils::s_typeChart[static_cast(Generation::VIII)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-viii.json")); - TypeUtils::s_typeChart[static_cast(Generation::IX)] = - getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-ix.json")); - } +void initializeTypeCharts() { + // Load type charts for each generation and store them in static arrays + TypeUtils::s_typeChart[static_cast(Generation::I)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-i.json")); + TypeUtils::s_typeChart[static_cast(Generation::II)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-ii.json")); + TypeUtils::s_typeChart[static_cast(Generation::III)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-iii.json")); + TypeUtils::s_typeChart[static_cast(Generation::IV)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-iv.json")); + TypeUtils::s_typeChart[static_cast(Generation::V)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-v.json")); + TypeUtils::s_typeChart[static_cast(Generation::VI)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-vi.json")); + TypeUtils::s_typeChart[static_cast(Generation::VII)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-vii.json")); + TypeUtils::s_typeChart[static_cast(Generation::VIII)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-viii.json")); + TypeUtils::s_typeChart[static_cast(Generation::IX)] = + getDuplicateTypeChart(loadTypeChartFromFile("../data/types/generation-ix.json")); }; // Definition of the static type chart array std::array, static_cast(Generation::IX) + 1> TypeUtils::s_typeChart; -// Static initializer to load type charts at program startup -static TypeChartInitializer s_initializer; } // namespace PokEng diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..c1ac5fa --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,16 @@ +#include + +#include "core/types.h" +#include "core/pokemon_table.h" + +using namespace PokEng; + +int main() { + + initializeTypeCharts(); + initializePokemonTable(); + + + + +} \ No newline at end of file