当前位置: 首页>>代码示例>>C++>>正文


C++ MapTree类代码示例

本文整理汇总了C++中MapTree的典型用法代码示例。如果您正苦于以下问题:C++ MapTree类的具体用法?C++ MapTree怎么用?C++ MapTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MapTree类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getDirFileName

    int VMapManager::loadMap(const char* pBasePath, unsigned int pMapId, int x, int y)
    {
		bool result = false;
		std::string dirFileName;
		if( pMapId >= MAX_MAPS )
			return false;

		if( IsTileMap( pMapId ) )
			dirFileName = getDirFileName( pMapId, x, y );
		else
			dirFileName = getDirFileName( pMapId );

		MapTree* instanceTree = m_maps[pMapId];
		if( instanceTree == NULL )
		{
			instanceTree = new MapTree( pBasePath );
			m_maps[pMapId] = instanceTree;
		}

		unsigned int mapTileIdent = MAP_TILE_IDENT(x,y);
		result = instanceTree->loadMap(dirFileName, mapTileIdent);
		if(!result)                                         // remove on fail
		{
			if(instanceTree->size() == 0)
			{
				m_maps[pMapId] = NULL;
				delete instanceTree;
			}
		}
		return(result);
    }
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:31,代码来源:VMapManager.cpp

示例2: getDirFileName

    bool VMapManager::_loadMap(const char* pBasePath, unsigned int pMapId, int x, int y, bool pForceTileLoad)
    {
        bool result = false;
        std::string dirFileName;
        if(pForceTileLoad || iMapsSplitIntoTiles.containsKey(pMapId))
        {
            dirFileName = getDirFileName(pMapId,x,y);
        }
        else
        {
            dirFileName = getDirFileName(pMapId);
        }
        MapTree* instanceTree;
        if(!iInstanceMapTrees.containsKey(pMapId))
        {
            instanceTree = new MapTree(pBasePath);
            iInstanceMapTrees.set(pMapId, instanceTree);
        }
        else
            instanceTree = iInstanceMapTrees.get(pMapId);

        unsigned int mapTileIdent = MAP_TILE_IDENT(x,y);
        result = instanceTree->loadMap(dirFileName, mapTileIdent);
        if(!result)                                         // remove on fail
        {
            if(instanceTree->size() == 0)
            {
                iInstanceMapTrees.remove(pMapId);
                delete instanceTree;
            }
        }
        return(result);
    }
开发者ID:801616,项目名称:mangos,代码行数:33,代码来源:VMapManager.cpp

示例3: convertPositionToInternalRep

    /**
    get the hit position and return true if we hit something
    otherwise the result pos will be the dest pos
    */
    bool VMapManager::getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float pModifyDist)
    {
        bool result = false;
        rx=x2;
        ry=y2;
        rz=z2;
        if(isLineOfSightCalcEnabled())
        {
            if(iInstanceMapTrees.containsKey(pMapId))
            {
                Vector3 pos1 = convertPositionToInternalRep(x1,y1,z1);
                Vector3 pos2 = convertPositionToInternalRep(x2,y2,z2);
                Vector3 resultPos;
                MapTree* mapTree = iInstanceMapTrees.get(pMapId);
                result = mapTree->getObjectHitPos(pos1, pos2, resultPos, pModifyDist);
                resultPos = convertPositionToMangosRep(resultPos.x,resultPos.y,resultPos.z);
                rx = resultPos.x;
                ry = resultPos.y;
                rz = resultPos.z;
#ifdef _VMAP_LOG_DEBUG
                Command c = Command();
                c.fillTestObjectHitCmd(pMapId, pos1, pos2, resultPos, result);
                iCommandLogger.appendCmd(c);
#endif
            }
        }
        return result;
    }
开发者ID:801616,项目名称:mangos,代码行数:32,代码来源:VMapManager.cpp

示例4: showMap

 void ModelContainerView::showMap(int pMapId, int x, int y) {
     MapTree* mt = iVMapManager->getInstanceMapTree(pMapId);
     std::string dirFileName = iVMapManager->getDirFileName(pMapId);
     if(!mt->hasDirFile(dirFileName)) {
         dirFileName = iVMapManager->getDirFileName(pMapId, x, y);
     }
     showMap(mt,dirFileName);
     iInstanceId = pMapId;
 }
开发者ID:Artea,项目名称:mangos-svn,代码行数:9,代码来源:ModelContainerView.cpp

示例5: parseVMap

 /*
  * Loads the map for the given mapid, x and y value.
  *
  *
  *
  */
 void
 ModelContainerView::parseVMap (int pMapId, int x, int y)
 {
   MapTree* mt = iVMapManager.getInstanceMapTree (pMapId);
   std::string dirFileName = iVMapManager.getDirFileName (pMapId, x, y);
   
   if (!mt->hasDirFile (dirFileName))
     dirFileName = iVMapManager.getDirFileName (pMapId);
   // This will add all models in map.
   parseVMap (mt, dirFileName);
 }
开发者ID:Jekls,项目名称:PhantomCore,代码行数:17,代码来源:ModelContainerView.cpp

示例6: convertPositionToInternalRep

	bool VMapManager::isOutDoors(unsigned int mapid, float x, float y, float z)
	{
		bool result = false;
		if( m_maps[mapid] != NULL )
		{
			Vector3 pos = convertPositionToInternalRep(x,y,z);
			MapTree* mapTree = m_maps[mapid];
			result = mapTree->isOutDoors(pos);
		}
		return(result);
	}
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:11,代码来源:VMapManager.cpp

示例7: convertPositionToInternalRepMod

	bool VMapManager::isOutDoors(unsigned int mapid, LocationVector & vec)
	{
		bool result = false;
		if( m_maps[mapid] != NULL )
		{
			Vector3 pos = convertPositionToInternalRepMod(vec);
			MapTree* mapTree = m_maps[mapid];
			result = mapTree->isOutDoors(pos);
		}
		return(result);
	}
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:11,代码来源:VMapManager.cpp

示例8: unloadMap

    void VMapManager::unloadMap(unsigned int pMapId)
    {
		if( m_maps[pMapId] != NULL )
        {
            MapTree* instanceTree = m_maps[ pMapId ];
            std::string dirFileName = getDirFileName(pMapId);
            instanceTree->unloadMap(dirFileName, 0);
            if(instanceTree->size() == 0)
            {
				m_maps[pMapId]=NULL;
                delete instanceTree;
            }
        }
    }
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:14,代码来源:VMapManager.cpp

示例9: getDirFileName

 void VMapManager::unloadMap(unsigned int pMapId)
 {
     if(iInstanceMapTrees.containsKey(pMapId))
     {
         MapTree* instanceTree = iInstanceMapTrees.get(pMapId);
         std::string dirFileName = getDirFileName(pMapId);
         instanceTree->unloadMap(dirFileName, 0, true);
         if(instanceTree->size() == 0)
         {
             iInstanceMapTrees.remove(pMapId);
             delete instanceTree;
         }
         Command c = Command();
         c.fillUnloadTileCmd(pMapId);
         iCommandLogger.appendCmd(c);
     }
 }
开发者ID:AscNHalf,项目名称:AscNHalf,代码行数:17,代码来源:VMapManager.cpp

示例10: convertPositionToInternalRep

 //int gGetHeightCounter = 0;
 float VMapManager::getHeight(unsigned int pMapId, float x, float y, float z)
 {
     float height = VMAP_INVALID_HEIGHT;                 //no height
     if(isHeightCalcEnabled() && iInstanceMapTrees.containsKey(pMapId))
     {
         Vector3 pos = convertPositionToInternalRep(x,y,z);
         MapTree* mapTree = iInstanceMapTrees.get(pMapId);
         height = mapTree->getHeight(pos);
         if(!(height < inf()))
         {
             height = VMAP_INVALID_HEIGHT;               //no height
         }
         Command c = Command();
         c.fillTestHeightCmd(pMapId,Vector3(x,y,z),height);
         iCommandLogger.appendCmd(c);
     }
     return(height);
 }
开发者ID:AscNHalf,项目名称:AscNHalf,代码行数:19,代码来源:VMapManager.cpp


注:本文中的MapTree类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。