mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Do not allow an instance map to be created twice if it already exists. Fix #4018.
This commit is contained in:
@@ -110,7 +110,7 @@ void MapInstanced::UnloadAll()
|
||||
- create the instance if it's not created already
|
||||
- the player is not actually added to the instance (only in InstanceMap::Add)
|
||||
*/
|
||||
Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
|
||||
Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
|
||||
{
|
||||
if (GetId() != mapId || !player)
|
||||
return NULL;
|
||||
@@ -124,7 +124,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
|
||||
// the instance id is set in battlegroundid
|
||||
NewInstanceId = player->GetBattlegroundId();
|
||||
if (!NewInstanceId) return NULL;
|
||||
map = _FindMap(NewInstanceId);
|
||||
map = FindInstanceMap(NewInstanceId);
|
||||
if (!map)
|
||||
map = CreateBattleground(NewInstanceId, player->GetBattleground());
|
||||
}
|
||||
@@ -151,7 +151,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
|
||||
{
|
||||
// solo/perm/group
|
||||
NewInstanceId = pSave->GetInstanceId();
|
||||
map = _FindMap(NewInstanceId);
|
||||
map = FindInstanceMap(NewInstanceId);
|
||||
// it is possible that the save exists but the map doesn't
|
||||
if (!map)
|
||||
map = CreateInstance(NewInstanceId, pSave, pSave->GetDifficulty());
|
||||
@@ -163,7 +163,11 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
|
||||
NewInstanceId = sMapMgr->GenerateInstanceId();
|
||||
|
||||
Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid());
|
||||
map = CreateInstance(NewInstanceId, NULL, diff);
|
||||
//Seems it is now possible, but I do not know if it should be allowed
|
||||
//ASSERT(!FindInstanceMap(NewInstanceId));
|
||||
map = FindInstanceMap(NewInstanceId);
|
||||
if (!map)
|
||||
map = CreateInstance(NewInstanceId, NULL, diff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user