Fix crash when closing otclient in debug mode
This commit is contained in:
		
							parent
							
								
									b50eecc779
								
							
						
					
					
						commit
						31efe0a82d
					
				| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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<CreatureTypePtr>& getCreatures() { return m_creatures; }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    void m_loadCreatureBuffer(TiXmlElement* elem, const CreatureTypePtr& m);
 | 
			
		||||
    void internalLoadCreatureBuffer(TiXmlElement* elem, const CreatureTypePtr& m);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    std::vector<CreatureTypePtr> m_creatures;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -79,7 +79,7 @@ void OTClient::init(const std::vector<std::string>& args)
 | 
			
		|||
 | 
			
		||||
void OTClient::terminate()
 | 
			
		||||
{
 | 
			
		||||
    g_creatures.clear();
 | 
			
		||||
    g_creatures.terminate();
 | 
			
		||||
    g_game.terminate();
 | 
			
		||||
    g_map.terminate();
 | 
			
		||||
    g_things.terminate();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue