Fix creature memory leaks
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
2500c6d996
commit
2966ba268f
|
@ -23,6 +23,12 @@ namespace CreatureLib::Library {
|
||||||
CreatureSpecies(uint16_t id, std::string name, const SpeciesVariant* defaultVariant,
|
CreatureSpecies(uint16_t id, std::string name, const SpeciesVariant* defaultVariant,
|
||||||
float genderRatio, std::string growthRate, uint8_t captureRate, uint8_t baseHappiness);
|
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]] const SpeciesVariant* GetVariant(const std::string& key) const;
|
||||||
[[nodiscard]] Gender GetRandomGender(Core::Random& rand) const;
|
[[nodiscard]] Gender GetRandomGender(Core::Random& rand) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace CreatureLib::Library {
|
||||||
SpeciesVariant(std::string name, float height, float weight, uint32_t baseExperience,
|
SpeciesVariant(std::string name, float height, float weight, uint32_t baseExperience,
|
||||||
std::vector<std::string> types, Core::StatisticSet baseStats, std::vector<std::string> talents,
|
std::vector<std::string> types, Core::StatisticSet baseStats, std::vector<std::string> talents,
|
||||||
std::vector<std::string> secretTalents);
|
std::vector<std::string> secretTalents);
|
||||||
|
|
||||||
[[nodiscard]] size_t GetTypeCount() const;
|
[[nodiscard]] size_t GetTypeCount() const;
|
||||||
[[nodiscard]] std::string GetType(size_t index) const;
|
[[nodiscard]] std::string GetType(size_t index) const;
|
||||||
[[nodiscard]] uint32_t GetStatistic(Core::Statistic stat) const;
|
[[nodiscard]] uint32_t GetStatistic(Core::Statistic stat) const;
|
||||||
|
|
|
@ -13,6 +13,8 @@ namespace CreatureLib::Library {
|
||||||
SpeciesLibrary() = default;
|
SpeciesLibrary() = default;
|
||||||
|
|
||||||
~SpeciesLibrary(){
|
~SpeciesLibrary(){
|
||||||
|
for (auto s: _species)
|
||||||
|
delete s.second;
|
||||||
_species.clear();
|
_species.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue