mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core: Add proper cleanup at exit for smart script waypoints and instance encounters
This commit is contained in:
@@ -35,6 +35,14 @@ void SmartWaypointMgr::LoadFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
for (UNORDERED_MAP<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr)
|
||||
{
|
||||
for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)
|
||||
delete pathItr->second;
|
||||
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
waypoint_map.clear();
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_SMARTAI_WP);
|
||||
@@ -84,6 +92,19 @@ void SmartWaypointMgr::LoadFromDB()
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
SmartWaypointMgr::~SmartWaypointMgr()
|
||||
{
|
||||
for (UNORDERED_MAP<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr)
|
||||
{
|
||||
for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)
|
||||
delete pathItr->second;
|
||||
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
waypoint_map.clear();
|
||||
}
|
||||
|
||||
void SmartAIMgr::LoadSmartAIFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1230,9 +1230,9 @@ typedef UNORDERED_MAP<uint32, ObjectList*> ObjectListMap;
|
||||
class SmartWaypointMgr
|
||||
{
|
||||
friend class ACE_Singleton<SmartWaypointMgr, ACE_Null_Mutex>;
|
||||
SmartWaypointMgr(){};
|
||||
SmartWaypointMgr() {}
|
||||
public:
|
||||
~SmartWaypointMgr(){};
|
||||
~SmartWaypointMgr();
|
||||
|
||||
void LoadFromDB();
|
||||
|
||||
|
||||
@@ -252,6 +252,10 @@ ObjectMgr::~ObjectMgr()
|
||||
itr->second.Clear();
|
||||
|
||||
_cacheTrainerSpellStore.clear();
|
||||
|
||||
for (DungeonEncounterContainer::iterator itr =_dungeonEncounterStore.begin(); itr != _dungeonEncounterStore.end(); ++itr)
|
||||
for (DungeonEncounterList::iterator encounterItr = itr->second.begin(); encounterItr != itr->second.end(); ++encounterItr)
|
||||
delete *encounterItr;
|
||||
}
|
||||
|
||||
void ObjectMgr::AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data)
|
||||
|
||||
Reference in New Issue
Block a user