diff --git a/src/otclient/creatures.cpp b/src/otclient/creatures.cpp index aa5d0bc0..305adf07 100644 --- a/src/otclient/creatures.cpp +++ b/src/otclient/creatures.cpp @@ -41,6 +41,13 @@ static bool isInZone(const Position& pos/* placePos*/, ); } +void CreatureManager::terminate() +{ + clearSpawns(); + clear(); + m_nullCreature = nullptr; +} + void Spawn::load(TiXmlElement* node) { Position centerPos = node->readPos("center"); @@ -276,14 +283,14 @@ void CreatureManager::loadCreatureBuffer(const std::string& buffer) if(attrib->ValueStr() != "look") continue; - m_loadCreatureBuffer(attrib, newType); + internalLoadCreatureBuffer(attrib, newType); break; } doc.Clear(); } -void CreatureManager::m_loadCreatureBuffer(TiXmlElement* attrib, const CreatureTypePtr& m) +void CreatureManager::internalLoadCreatureBuffer(TiXmlElement* attrib, const CreatureTypePtr& m) { if(std::find(m_creatures.begin(), m_creatures.end(), m) != m_creatures.end()) return; diff --git a/src/otclient/creatures.h b/src/otclient/creatures.h index 3876e38d..8d637d4d 100644 --- a/src/otclient/creatures.h +++ b/src/otclient/creatures.h @@ -99,6 +99,7 @@ public: CreatureManager(); void clear() { m_creatures.clear(); } void clearSpawns(); + void terminate(); void loadMonsters(const std::string& file); void loadSingleCreature(const std::string& file); @@ -119,7 +120,7 @@ public: const std::vector& getCreatures() { return m_creatures; } protected: - void m_loadCreatureBuffer(TiXmlElement* elem, const CreatureTypePtr& m); + void internalLoadCreatureBuffer(TiXmlElement* elem, const CreatureTypePtr& m); private: std::vector m_creatures; diff --git a/src/otclient/otclient.cpp b/src/otclient/otclient.cpp index 9b627ec5..bd077404 100644 --- a/src/otclient/otclient.cpp +++ b/src/otclient/otclient.cpp @@ -79,7 +79,7 @@ void OTClient::init(const std::vector& args) void OTClient::terminate() { - g_creatures.clear(); + g_creatures.terminate(); g_game.terminate(); g_map.terminate(); g_things.terminate();