Core/ObjectMgr: Refactor sInstanceTemplate
This commit is contained in:
@@ -2402,10 +2402,10 @@ void InstanceMap::CreateInstanceData(bool load)
|
||||
if (i_data != NULL)
|
||||
return;
|
||||
|
||||
InstanceTemplate const* mInstance = ObjectMgr::GetInstanceTemplate(GetId());
|
||||
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId());
|
||||
if (mInstance)
|
||||
{
|
||||
i_script_id = mInstance->script_id;
|
||||
i_script_id = mInstance->ScriptId;
|
||||
i_data = sScriptMgr->CreateInstanceData(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,14 +216,9 @@ struct CreatureMover
|
||||
|
||||
struct InstanceTemplate
|
||||
{
|
||||
uint32 map;
|
||||
uint32 parent;
|
||||
float startLocX;
|
||||
float startLocY;
|
||||
float startLocZ;
|
||||
float startLocO;
|
||||
uint32 script_id;
|
||||
bool allowMount;
|
||||
uint32 Parent;
|
||||
uint32 ScriptId;
|
||||
bool AllowMount;
|
||||
};
|
||||
|
||||
enum LevelRequirementVsMode
|
||||
|
||||
@@ -179,7 +179,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
|
||||
sLog->outError("CreateInstance: no entry for map %d", GetId());
|
||||
ASSERT(false);
|
||||
}
|
||||
const InstanceTemplate * iTemplate = ObjectMgr::GetInstanceTemplate(GetId());
|
||||
const InstanceTemplate * iTemplate = sObjectMgr->GetInstanceTemplate(GetId());
|
||||
if (!iTemplate)
|
||||
{
|
||||
sLog->outError("CreateInstance: no instance template for map %d", GetId());
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -84,21 +84,21 @@ class MapManager
|
||||
void UnloadAll();
|
||||
|
||||
static bool ExistMapAndVMap(uint32 mapid, float x, float y);
|
||||
static bool IsValidMAP(uint32 mapid);
|
||||
static bool IsValidMAP(uint32 mapid, bool startUp);
|
||||
|
||||
static bool IsValidMapCoord(uint32 mapid, float x,float y)
|
||||
{
|
||||
return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x,y);
|
||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x,y);
|
||||
}
|
||||
|
||||
static bool IsValidMapCoord(uint32 mapid, float x,float y,float z)
|
||||
{
|
||||
return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x,y,z);
|
||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x,y,z);
|
||||
}
|
||||
|
||||
static bool IsValidMapCoord(uint32 mapid, float x,float y,float z,float o)
|
||||
{
|
||||
return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x,y,z,o);
|
||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x,y,z,o);
|
||||
}
|
||||
|
||||
static bool IsValidMapCoord(WorldLocation const& loc)
|
||||
|
||||
Reference in New Issue
Block a user