diff --git a/src/Library/CreatureData/CreatureSpecies.hpp b/src/Library/CreatureData/CreatureSpecies.hpp index 28c368a..feb6719 100644 --- a/src/Library/CreatureData/CreatureSpecies.hpp +++ b/src/Library/CreatureData/CreatureSpecies.hpp @@ -23,6 +23,12 @@ namespace CreatureLib::Library { CreatureSpecies(uint16_t id, std::string name, const SpeciesVariant* defaultVariant, float genderRatio, std::string growthRate, uint8_t captureRate, uint8_t baseHappiness); + ~CreatureSpecies(){ + for (auto v: _variants) + delete v.second; + _variants.clear(); + } + [[nodiscard]] const SpeciesVariant* GetVariant(const std::string& key) const; [[nodiscard]] Gender GetRandomGender(Core::Random& rand) const; }; diff --git a/src/Library/CreatureData/SpeciesVariant.hpp b/src/Library/CreatureData/SpeciesVariant.hpp index 0071cc6..463428e 100644 --- a/src/Library/CreatureData/SpeciesVariant.hpp +++ b/src/Library/CreatureData/SpeciesVariant.hpp @@ -27,6 +27,7 @@ namespace CreatureLib::Library { SpeciesVariant(std::string name, float height, float weight, uint32_t baseExperience, std::vector types, Core::StatisticSet baseStats, std::vector talents, std::vector secretTalents); + [[nodiscard]] size_t GetTypeCount() const; [[nodiscard]] std::string GetType(size_t index) const; [[nodiscard]] uint32_t GetStatistic(Core::Statistic stat) const; diff --git a/src/Library/SpeciesLibrary.hpp b/src/Library/SpeciesLibrary.hpp index e225abd..1f26050 100644 --- a/src/Library/SpeciesLibrary.hpp +++ b/src/Library/SpeciesLibrary.hpp @@ -13,6 +13,8 @@ namespace CreatureLib::Library { SpeciesLibrary() = default; ~SpeciesLibrary(){ + for (auto s: _species) + delete s.second; _species.clear(); }