aboutsummaryrefslogtreecommitdiff
path: root/src/game/MapInstanced.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/MapInstanced.cpp')
-rw-r--r--src/game/MapInstanced.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp
index ee668e9080a..89be57275bb 100644
--- a/src/game/MapInstanced.cpp
+++ b/src/game/MapInstanced.cpp
@@ -116,15 +116,8 @@ 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::GetInstance(const WorldObject* obj)
+Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
{
- if(obj->GetTypeId() == TYPEID_UNIT)
- {
- assert(obj->GetMapId() == GetId() && obj->GetInstanceId());
- return _FindMap(obj->GetInstanceId());
- }
-
- Player* player = (Player*)obj;
uint32 instanceId = player->GetInstanceId();
if(instanceId)
@@ -193,10 +186,10 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
// some instances only have one difficulty
if (entry && !entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL;
- sLog.outDebug("MapInstanced::CreateInstance: %smap instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal");
+ sLog.outDebug("MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal");
- InstanceMap *map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty);
- assert(map->IsDungeon());
+ InstanceMap *map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this);
+ ASSERT(map->IsDungeon());
bool load_data = save != NULL;
map->CreateInstanceData(load_data);
@@ -212,8 +205,8 @@ BattleGroundMap* MapInstanced::CreateBattleGround(uint32 InstanceId)
sLog.outDebug("MapInstanced::CreateBattleGround: map bg %d for %d created.", InstanceId, GetId());
- BattleGroundMap *map = new BattleGroundMap(GetId(), GetGridExpiry(), InstanceId);
- assert(map->IsBattleGroundOrArena());
+ BattleGroundMap *map = new BattleGroundMap(GetId(), GetGridExpiry(), InstanceId, this);
+ ASSERT(map->IsBattleGroundOrArena());
m_InstancedMaps[InstanceId] = map;
return map;
@@ -245,9 +238,7 @@ void MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
bool MapInstanced::CanEnter(Player *player)
{
- if(Map* map = GetInstance(player))
- return map->CanEnter(player);
-
- return false;
+ //assert(false);
+ return true;
}