Mark destructors of several libraries as virtual.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f0c3f84a29
commit
b98b470f0d
|
@ -14,7 +14,7 @@ namespace CreatureLib::Library {
|
|||
AttackLibrary(size_t initialCapacity = 32)
|
||||
: _attacks(std::unordered_map<std::string, const AttackData*>(initialCapacity)){};
|
||||
|
||||
~AttackLibrary() {
|
||||
virtual ~AttackLibrary() {
|
||||
for (auto attack : _attacks) {
|
||||
delete attack.second;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace CreatureLib::Library {
|
|||
GrowthRateLibrary(size_t initialCapacity = 10)
|
||||
: _growthRates(std::unordered_map<std::string, GrowthRate*>(initialCapacity)) {}
|
||||
|
||||
~GrowthRateLibrary() {
|
||||
virtual ~GrowthRateLibrary() {
|
||||
for (auto gr : _growthRates) {
|
||||
delete gr.second;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace CreatureLib::Library {
|
|||
public:
|
||||
ItemLibrary(size_t initialCapacity = 32)
|
||||
: _items(std::unordered_map<std::string, const Item*>(initialCapacity)){};
|
||||
~ItemLibrary() { _items.clear(); }
|
||||
virtual ~ItemLibrary() { _items.clear(); }
|
||||
|
||||
[[nodiscard]] const Item* GetItem(const std::string& name) const;
|
||||
[[nodiscard]] const Item* operator[](const std::string& name) const;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace CreatureLib::Library {
|
|||
SpeciesLibrary(size_t initialCapacity = 32)
|
||||
: _species(std::unordered_map<std::string, const CreatureSpecies*>(initialCapacity)){};
|
||||
|
||||
~SpeciesLibrary() {
|
||||
virtual ~SpeciesLibrary() {
|
||||
for (auto s : _species)
|
||||
delete s.second;
|
||||
_species.clear();
|
||||
|
|
Loading…
Reference in New Issue