DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState* save) { // make sure we have a valid map id if (!sMapStore.LookupEntry(id)) { sLog.outError("CreateDungeonMap: no entry for map %d", id); MANGOS_ASSERT(false); } if (!ObjectMgr::GetInstanceTemplate(id)) { sLog.outError("CreateDungeonMap: no instance template for map %d", id); MANGOS_ASSERT(false); } // some instances only have one difficulty if (!GetMapDifficultyData(id, difficulty)) difficulty = DUNGEON_DIFFICULTY_NORMAL; DEBUG_LOG("MapInstanced::CreateDungeonMap: %s map instance %d for %d created with difficulty %d", save ? "" : "new ", InstanceId, id, difficulty); DungeonMap* map = new DungeonMap(id, i_gridCleanUpDelay, InstanceId, difficulty); // Dungeons can have saved instance data bool load_data = save != nullptr; map->Initialize(load_data); return map; }