aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/MapInstanced.cpp
diff options
context:
space:
mode:
authormegamage <none@none.none>2011-11-23 09:34:08 -0500
committermegamage <none@none.none>2011-11-23 09:34:08 -0500
commit298c162c86130d59c6c60f2fedc7a9b2af034a8d (patch)
treea9d678c04646a98aaf715d64252ab56411a1f0fd /src/server/game/Maps/MapInstanced.cpp
parent1b3017472be902ddfb900230ea8efc07132927a1 (diff)
Do not allow an instance map to be created twice if it already exists. Fix #4018.
Diffstat (limited to 'src/server/game/Maps/MapInstanced.cpp')
-rwxr-xr-xsrc/server/game/Maps/MapInstanced.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp
index bbade4c9dc3..a56a193ba64 100755
--- a/src/server/game/Maps/MapInstanced.cpp
+++ b/src/server/game/Maps/MapInstanced.cpp
@@ -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);
}
}