// 在当前编辑的区域中添加一个新的点 unsigned long CNpcPatrolAction::AddNewPoint(Ogre::Vector3 position) { if(0 == m_UnreachRegionMap.count(m_ulCurEditRegionId)) { return 0 ; } CUnreachRegion* pRegion = NULL; pRegion = m_UnreachRegionMap[m_ulCurEditRegionId]; if(pRegion) { m_ulCurEditPointId = pRegion->AddNewPoint(position); if( m_ulCurEditPointId > 0 ) { //添加成功了 if( position.y == -100000.0f ) { pRegion->GetPointInfoById( m_ulCurEditPointId )->SetValuedY( false ); } } return m_ulCurEditPointId; } return 0; }
// 指定区域id, 指定点的id, 指定位置, 添加一个小球. void CNpcPatrolAction::AddNewPoint(unsigned long ulRegionId, unsigned long ulPointId, Ogre::Vector3 position) { // 得到当前正在编辑的区域的信息. CUnreachRegion* pRegion = NULL; pRegion = GetRegionById(ulRegionId); if(pRegion) { pRegion->AddNewPoint(ulPointId, position); getSceneManipulator()->_fireRegionAddNewPoint(ulRegionId, ulPointId, position); } }