Core/Battlegrounds: Free instance id in the proper place.

fixes #966
This commit is contained in:
leak
2011-03-14 20:38:43 +01:00
parent 28c264402b
commit 6a4ffb4be1
2 changed files with 6 additions and 3 deletions

View File

@@ -111,9 +111,6 @@ void BattlegroundMgr::Update(uint32 diff)
if (!m_ClientBattlegroundIds[i][bg->GetBracketId()].empty())
m_ClientBattlegroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
// Free up the instance id and allow it to be reused
sMapMgr->FreeInstanceId(bg->GetInstanceID());
delete bg;
}
}

View File

@@ -245,9 +245,15 @@ bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
// so in the next map creation, (EnsureGridCreated actually) VMaps will be reloaded
Map::UnloadAll();
}
// Free up the instance id and allow it to be reused for bgs and arenas (other instances are handled in the InstanceSaveMgr)
if (itr->second->IsBattlegroundOrArena())
sMapMgr->FreeInstanceId(itr->second->GetInstanceId());
// erase map
delete itr->second;
m_InstancedMaps.erase(itr++);
return true;
}