Mark destructors of several libraries as virtual.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-01-02 17:48:14 +01:00
parent f0c3f84a29
commit b98b470f0d
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
4 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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();