示例#1
0
AreaTable* TerrainHolder::GetArea(float x, float y, float z)
{
	AreaTable* ret = NULL;
	float vmap_z = z;
	VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();

	uint32 flags;
	int32 adtid, rootid, groupid;

	if(vmgr->getAreaInfo(m_mapid, x, y, vmap_z, flags, adtid, rootid, groupid))
	{
		float adtz = GetADTLandHeight(x, y);

		if(adtz > vmap_z && z + 1 > adtz)
			return GetArea2D(x, y);

		WMOAreaTableEntry* wmoArea = sWorld.GetWMOAreaData(rootid, adtid, groupid);
		if(wmoArea != NULL)
			ret = dbcArea.LookupEntryForced(wmoArea->areaId);
	}

	if(ret == NULL)  //fall back to 2d if no vmaps or vmap has no areaid set
		ret = GetArea2D(x, y);
	return ret;
}
示例#2
0
bool TerrainInfo::GetAreaInfo(float x, float y, float z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const
{
    float vmap_z = z;
    VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
    if (vmgr->getAreaInfo(GetMapId(), x, y, vmap_z, flags, adtId, rootId, groupId))
    {
        // check if there's terrain between player height and object height
        if(GridMap *gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
        {
            float _mapheight = gmap->getHeight(x,y);
            // z + 2.0f condition taken from GetHeight(), not sure if it's such a great choice...
            if(z + 2.0f > _mapheight &&  _mapheight > vmap_z)
                return false;
        }
        return true;
    }
    return false;
}