Core: Add proper cleanup at exit for smart script waypoints and instance encounters

This commit is contained in:
Shauren
2012-03-24 18:42:35 +01:00
parent a306c00d43
commit e64d1d43dd
3 changed files with 27 additions and 2 deletions

View File

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