Core/ObjectMgr: Refactor sInstanceTemplate

This commit is contained in:
leak
2011-04-28 22:16:13 +02:00
parent 19cab2c508
commit 5aeb4fe794
14 changed files with 81 additions and 58 deletions

View File

@@ -151,7 +151,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
if (!entry->IsDungeon())
return true;
InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(mapid);
InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(mapid);
if (!instance)
return false;
@@ -201,8 +201,8 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
if (corpseMap == mapid)
break;
InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(corpseMap);
corpseMap = instance ? instance->parent : 0;
InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(corpseMap);
corpseMap = instance ? instance->Parent : 0;
} while (corpseMap);
if (!corpseMap)
@@ -298,10 +298,15 @@ bool MapManager::ExistMapAndVMap(uint32 mapid, float x,float y)
return Map::ExistMap(mapid,gx,gy) && Map::ExistVMap(mapid,gx,gy);
}
bool MapManager::IsValidMAP(uint32 mapid)
bool MapManager::IsValidMAP(uint32 mapid, bool startUp)
{
MapEntry const* mEntry = sMapStore.LookupEntry(mapid);
return mEntry && (!mEntry->IsDungeon() || ObjectMgr::GetInstanceTemplate(mapid));
if (startUp)
return mEntry ? true : false;
else
return mEntry && (!mEntry->IsDungeon() || sObjectMgr->GetInstanceTemplate(mapid));
// TODO: add check for battleground template
}