本文整理汇总了C++中BuildShortcut函数的典型用法代码示例。如果您正苦于以下问题:C++ BuildShortcut函数的具体用法?C++ BuildShortcut怎么用?C++ BuildShortcut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BuildShortcut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getEndPosition
bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest)
{
Vector3 oldDest = getEndPosition();
Vector3 dest(destX, destY, destZ);
setEndPosition(dest);
float x, y, z;
m_sourceUnit->GetPosition(x, y, z);
Vector3 start(x, y, z);
setStartPosition(start);
m_forceDestination = forceDest;
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate() for %u \n", m_sourceUnit->GetGUIDLow());
// make sure navMesh works - we can run on map w/o mmap
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING) ||
!HaveTile(start) || !HaveTile(dest))
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
updateFilter();
BuildPolyPath(start, dest);
return true;
}
示例2: if
void GuiToolstripCommand::UpdateShortcutOwner()
{
GuiControlHost* host = nullptr;
if (auto control = dynamic_cast<GuiControl*>(attachedRootObject))
{
host = control->GetRelatedControlHost();
}
else if (auto composition = dynamic_cast<GuiGraphicsComposition*>(attachedRootObject))
{
host = composition->GetRelatedControlHost();
}
if (shortcutOwner != host)
{
if (shortcutOwner)
{
ReplaceShortcut(nullptr, nullptr);
shortcutOwner = nullptr;
}
shortcutOwner = host;
if (shortcutBuilder && !shortcutKeyItem)
{
BuildShortcut(shortcutBuilder->text);
}
}
}
示例3: dest
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest)
{
float x, y, z;
_sourceUnit->GetPosition(x, y, z);
if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z))
return false;
Vector3 dest(destX, destY, destZ);
SetEndPosition(dest);
Vector3 start(x, y, z);
SetStartPosition(start);
_forceDestination = forceDest;
sLog->outDebug(LOG_FILTER_MAPS, "++ PathGenerator::CalculatePath() for %u \n", _sourceUnit->GetGUIDLow());
// make sure navMesh works - we can run on map w/o mmap
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
if (!_navMesh || !_navMeshQuery || _sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) ||
!HaveTile(start) || !HaveTile(dest))
{
BuildShortcut();
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
UpdateFilter();
BuildPolyPath(start, dest);
return true;
}
示例4: m_polyLength
////////////////// PathInfo //////////////////
PathInfo::PathInfo(const Unit* owner, const float destX, const float destY, const float destZ, bool useStraightPath) :
m_polyLength(0), m_type(PATHFIND_BLANK), m_useStraightPath(useStraightPath),
m_sourceUnit(owner), m_navMesh(NULL), m_navMeshQuery(NULL)
{
PathNode endPoint(destX, destY, destZ);
setEndPosition(endPoint);
float x,y,z;
m_sourceUnit->GetPosition(x, y, z);
PathNode startPoint(x, y, z);
setStartPosition(startPoint);
PATH_DEBUG("++ PathInfo::PathInfo for %u \n", m_sourceUnit->GetGUID());
uint32 mapId = m_sourceUnit->GetMapId();
if (MMAP::MMapFactory::IsPathfindingEnabled(mapId))
{
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
m_navMesh = mmap->GetNavMesh(mapId);
m_navMeshQuery = mmap->GetNavMeshQuery(mapId, m_sourceUnit->GetInstanceId());
}
createFilter();
if (m_navMesh && m_navMeshQuery && !m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING) && !(m_sourceUnit->GetTypeId() == TYPEID_UNIT ? ((Creature*)m_sourceUnit)->IsWorldBoss() : false))
{
BuildPolyPath(startPoint, endPoint);
}
else
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
}
}
示例5: dtVcopy
void PathInfo::BuildPointPath(float *startPoint, float *endPoint)
{
// get the actual reachable point on last poly in path
float closestPoint[VERTEX_SIZE];
if ((m_type & PATHFIND_INCOMPLETE)
&& DT_SUCCESS == m_navMeshQuery->closestPointOnPoly(m_pathPolyRefs[m_polyLength-1], endPoint, closestPoint))
{
dtVcopy(endPoint, closestPoint);
setActualEndPosition(PathNode(endPoint[2],endPoint[0],endPoint[1]));
}
float pathPoints[MAX_POINT_PATH_LENGTH*VERTEX_SIZE];
uint32 pointCount = 0;
dtStatus dtResult = DT_FAILURE;
if (m_useStraightPath)
{
dtResult = m_navMeshQuery->findStraightPath(
startPoint, // start position
endPoint, // end position
m_pathPolyRefs, // current path
m_polyLength, // lenth of current path
pathPoints, // [out] path corner points
NULL, // [out] flags
NULL, // [out] shortened path
(int*)&pointCount,
MAX_POINT_PATH_LENGTH); // maximum number of points/polygons to use
}
else
{
dtResult = findSmoothPath(
startPoint, // start position
endPoint, // end position
m_pathPolyRefs, // current path
m_polyLength, // length of current path
pathPoints, // [out] path corner points
(int*)&pointCount,
MAX_POINT_PATH_LENGTH); // maximum number of points
}
if (pointCount < 2 || dtResult != DT_SUCCESS)
{
// only happens if pass bad data to findStraightPath or navmesh is broken
// single point paths can be generated here
// TODO : check the exact cases
PATH_DEBUG("++ PathInfo::BuildPointPath FAILED! path sized %d returned\n", pointCount);
BuildShortcut();
m_type = PATHFIND_NOPATH;
return;
}
m_pathPoints.resize(pointCount);
for (uint32 i = 0; i < pointCount; ++i)
m_pathPoints.set(i, PathNode(pathPoints[i*VERTEX_SIZE+2], pathPoints[i*VERTEX_SIZE], pathPoints[i*VERTEX_SIZE+1]));
// first point is always our current location - we need the next one
setNextPosition(m_pathPoints[1]);
PATH_DEBUG("++ PathInfo::BuildPointPath path type %d size %d poly-size %d\n", m_type, pointCount, m_polyLength);
}
示例6: newDest
bool PathInfo::Update(const float destX, const float destY, const float destZ, bool useStraightPath)
{
PathNode newDest(destX, destY, m_sourceUnit->GetMap()->GetHeight(destX,destY,destZ,100.0f));
PathNode oldDest = getEndPosition();
setEndPosition(newDest);
float x, y, z;
m_sourceUnit->GetPosition(x, y, z);
PathNode newStart(x, y, m_sourceUnit->GetMap()->GetHeight(x,y,z,100.0f));
PathNode oldStart = getStartPosition();
setStartPosition(newStart);
m_useStraightPath = useStraightPath;
PATH_DEBUG("++ PathInfo::Update() for %u \n", m_sourceUnit->GetGUID());
// make sure navMesh works - we can run on map w/o mmap
if (!m_navMesh || !m_navMeshQuery)
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
float dist = m_sourceUnit->GetObjectBoundingRadius();
bool oldDestInRange = inRange(oldDest, newDest, dist, dist);
// this can happen only if caller did a bad job calculating the need for path update
if (oldDestInRange && inRange(newStart, oldStart, dist, dist))
{
setEndPosition(oldDest);
setStartPosition(oldStart);
return false;
}
// check if destination moved - if not we can optimize something here
// we are following old, precalculated path?
if (oldDestInRange && m_pathPoints.size() > 2)
{
// our target is not moving - we just coming closer
// we are moving on precalculated path - enjoy the ride
PATH_DEBUG("++ PathInfo::Update:: precalculated path\n");
m_pathPoints.crop(1, 0);
setNextPosition(m_pathPoints[1]);
return false;
}
else
{
// target moved, so we need to update the poly path
BuildPolyPath(newStart, newDest);
return true;
}
}
示例7: getEndPosition
bool PathFinderMovementGenerator::calculate(float destX, float destY, float destZ, bool forceDest)
{
if (!SkyFire::IsValidMapCoord(destX, destY, destZ) ||
!SkyFire::IsValidMapCoord(m_sourceUnit->GetPositionX(), m_sourceUnit->GetPositionY(), m_sourceUnit->GetPositionZ()))
return false;
Vector3 oldDest = getEndPosition();
Vector3 dest(destX, destY, destZ);
setEndPosition(dest);
float x, y, z;
m_sourceUnit->GetPosition(x, y, z);
Vector3 start(x, y, z);
setStartPosition(start);
m_forceDestination = forceDest;
sLog->outDebug(LOG_FILTER_MAPS, "++ PathFinderMovementGenerator::calculate() for %u \n", m_sourceUnit->GetGUIDLow());
// make sure navMesh works - we can run on map w/o mmap
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) ||
!HaveTile(start) || !HaveTile(dest))
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
updateFilter();
// check if destination moved - if not we can optimize something here
// we are following old, precalculated path?
float dist = m_sourceUnit->GetObjectSize();
if (inRange(oldDest, dest, dist, dist) && m_pathPoints.size() > 2)
{
// our target is not moving - we just coming closer
// we are moving on precalculated path - enjoy the ride
sLog->outStaticDebug("++ PathFinderMovementGenerator::calculate:: precalculated path\n");
m_pathPoints.erase(m_pathPoints.begin());
return false;
}
else
{
// target moved, so we need to update the poly path
m_navMeshLock->acquire_read();
BuildPolyPath(start, dest);
m_navMeshLock->release();
return true;
}
}
示例8: GetEndPosition
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest)
{
float x, y, z;
_sourceUnit->GetPosition(x, y, z);
if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z))
return false;
Vector3 oldDest = GetEndPosition();
Vector3 dest(destX, destY, destZ);
SetEndPosition(dest);
Vector3 start(x, y, z);
SetStartPosition(start);
_forceDestination = forceDest;
sLog->outDebug(LOG_FILTER_MAPS, "++ PathGenerator::CalculatePath() for %u \n", _sourceUnit->GetGUIDLow());
// make sure navMesh works - we can run on map w/o mmap
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
if (!_navMesh || !_navMeshQuery || _sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) ||
!HaveTile(start) || !HaveTile(dest))
{
BuildShortcut();
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
UpdateFilter();
// check if destination moved - if not we can optimize something here
// we are following old, precalculated path?
float dist = _sourceUnit->GetObjectSize();
if (oldDest != Vector3::zero() && InRange(oldDest, dest, dist, dist) && _pathPoints.size() > 2)
{
// our target is not moving - we just coming closer
// we are moving on precalculated path - enjoy the ride
sLog->outDebug(LOG_FILTER_MAPS, "++ PathGenerator::CalculatePath:: precalculated path\n");
_pathPoints.erase(_pathPoints.begin());
return false;
}
else
{
// target moved, so we need to update the poly path
BuildPolyPath(start, dest);
return true;
}
}
示例9: newDest
bool PathInfo::Update(const float destX, const float destY, const float destZ,
bool useStraightPath, bool forceDest)
{
PathNode newDest(destX, destY, destZ);
PathNode oldDest = getEndPosition();
setEndPosition(newDest);
float x, y, z;
m_sourceUnit->GetPosition(x, y, z);
PathNode newStart(x, y, z);
PathNode oldStart = getStartPosition();
setStartPosition(newStart);
m_useStraightPath = useStraightPath;
m_forceDestination = forceDest;
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathInfo::Update() for %u \n", m_sourceUnit->GetGUID());
// make sure navMesh works - we can run on map w/o mmap
if (!m_navMesh || !m_navMeshQuery || !HaveTiles(newDest) ||
m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING))
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
updateFilter();
// check if destination moved - if not we can optimize something here
// we are following old, precalculated path?
float dist = m_sourceUnit->GetObjectBoundingRadius();
if (inRange(oldDest, newDest, dist, dist) && m_pathPoints.size() > 2)
{
// our target is not moving - we just coming closer
// we are moving on precalculated path - enjoy the ride
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathInfo::Update:: precalculated path\n");
m_pathPoints.crop(1, 0);
setNextPosition(m_pathPoints[1]);
return false;
}
else
{
// target moved, so we need to update the poly path
BuildPolyPath(newStart, newDest);
return true;
}
}
示例10: getEndPosition
bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest)
{
Vector3 oldDest = getEndPosition();
Vector3 dest(destX, destY, destZ);
setEndPosition(dest);
float x, y, z;
m_sourceUnit->GetPosition(x, y, z);
Vector3 start(x, y, z);
setStartPosition(start);
m_forceDestination = forceDest;
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate() for %u \n", m_sourceUnit->GetGUIDLow());
// make sure navMesh works - we can run on map w/o mmap
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING) ||
!HaveTile(start) || !HaveTile(dest))
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
updateFilter();
// check if destination moved - if not we can optimize something here
// we are following old, precalculated path?
float dist = m_sourceUnit->GetObjectBoundingRadius();
if (inRange(oldDest, dest, dist, dist) && m_pathPoints.size() > 2)
{
// our target is not moving - we just coming closer
// we are moving on precalculated path - enjoy the ride
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::calculate:: precalculated path\n");
m_pathPoints.erase(m_pathPoints.begin());
return false;
}
else
{
// target moved, so we need to update the poly path
ReadGuard Guard(MMAP::MMapFactory::createOrGetMMapManager()->GetLock(m_sourceUnit->GetMapId()));
BuildPolyPath(start, dest);
return true;
}
}
示例11: dest
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool /*forceDest*/)
{
float x, y, z;
_sourceUnit->GetPosition(x, y, z);
if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z))
return false;
G3D::Vector3 dest(destX, destY, destZ);
SetEndPosition(dest);
SetActualEndPosition(GetEndPosition());
G3D::Vector3 start(x, y, z);
SetStartPosition(start);
TC_LOG_DEBUG("maps", "++ PathGenerator::CalculatePath() for %u\n", _sourceUnit->GetGUIDLow());
BuildShortcut();
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
示例12: getEndPosition
bool PathInfo::Update(float destX, float destY, float destZ, bool forceDest)
{
float x, y, z;
m_sourceUnit->GetPosition(x, y, z);
if (!Oregon::IsValidMapCoord(destX, destY, destZ) || !Oregon::IsValidMapCoord(x, y, z))
{
sLog.outMMap("PathInfo::Update() called with invalid map coords, destX: %f destY: %f destZ: %f x: %f y: %f z: %f for creature %u", destX, destY, destZ, x, y, z, m_sourceUnit->GetGUIDLow());
m_type = PATHFIND_NOPATH;
return false;
}
Vector3 oldDest = getEndPosition();
Vector3 newDest(destX, destY, destZ);
setEndPosition(newDest);
Vector3 newStart(x, y, z);
setStartPosition(newStart);
m_forceDestination = forceDest;
sLog.outMMap("PathInfo::Update() for %u \n", m_sourceUnit->GetGUIDLow());
// make sure navMesh works - we can run on map w/o mmap
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) ||
!HaveTile(newStart) || !HaveTile(newDest))
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
updateFilter();
BuildPolyPath(newStart, newDest);
return true;
}
示例13: m_pathPolyRefs
////////////////// PathInfo //////////////////
PathInfo::PathInfo(const Unit* owner, const float destX, const float destY, const float destZ, bool useStraightPath) : m_pathPolyRefs(NULL),
m_polyLength(0), m_type(PATHFIND_BLANK), m_useStraightPath(useStraightPath), m_sourceUnit(owner),
m_navMesh(NULL), m_navMeshQuery(NULL)
{
PathNode endPoint(destX, destY, destZ);
setEndPosition(endPoint);
float x,y,z;
m_sourceUnit->GetPosition(x, y, z);
PathNode startPoint(x, y, z);
setStartPosition(startPoint);
PATH_DEBUG("++ PathInfo::PathInfo for %u \n", m_sourceUnit->GetGUID());
const Map* map = m_sourceUnit->GetMap();
if (map->IsPathfindingEnabled())
m_navMesh = map->GetNavMesh();
if (m_navMesh)
{
m_navMeshQuery = dtAllocNavMeshQuery();
ASSERT(m_navMeshQuery);
if(DT_SUCCESS != m_navMeshQuery->init(m_navMesh, MESH_MAX_NODES))
{
sLog->outError("%u's PathInfo navMeshQuery failed to init", m_sourceUnit->GetGUID());
return;
}
BuildPolyPath(startPoint, endPoint);
}
else
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
}
}
示例14: m_polyLength
////////////////// PathInfo //////////////////
PathInfo::PathInfo(const Unit* owner, float destX, float destY, float destZ, bool forceDest) :
m_polyLength(0), m_type(PATHFIND_BLANK),
m_forceDestination(forceDest), m_pointPathLimit(MAX_POINT_PATH_LENGTH),
m_sourceUnit(owner), m_navMesh(NULL), m_navMeshQuery(NULL)
{
PathNode endPoint(destX, destY, destZ);
setEndPosition(endPoint);
float x,y,z;
m_sourceUnit->GetPosition(x, y, z);
PathNode startPoint(x, y, z);
setStartPosition(startPoint);
//DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathInfo::PathInfo for %u \n", m_sourceUnit->GetGUIDLow());
uint32 mapId = m_sourceUnit->GetMapId();
if (MMAP::MMapFactory::IsPathfindingEnabled(mapId))
{
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
m_navMesh = mmap->GetNavMesh(mapId);
m_navMeshQuery = mmap->GetNavMeshQuery(mapId, m_sourceUnit->GetInstanceId());
}
createFilter();
if (m_navMesh && m_navMeshQuery && HaveTile(endPoint) &&
!m_sourceUnit->hasUnitState(UNIT_STAT_IGNORE_PATHFINDING))
{
BuildPolyPath(startPoint, endPoint);
}
else
{
BuildShortcut();
m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
}
}
示例15: TC_METRIC_EVENT
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest, bool straightLine)
{
float x, y, z;
_sourceUnit->GetPosition(x, y, z);
if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z))
return false;
TC_METRIC_EVENT("mmap_events", "CalculatePath", "");
G3D::Vector3 dest(destX, destY, destZ);
SetEndPosition(dest);
G3D::Vector3 start(x, y, z);
SetStartPosition(start);
_forceDestination = forceDest;
_straightLine = straightLine;
TC_LOG_DEBUG("maps", "++ PathGenerator::CalculatePath() for %s", _sourceUnit->GetGUID().ToString().c_str());
// make sure navMesh works - we can run on map w/o mmap
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
if (!_navMesh || !_navMeshQuery || _sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) ||
!HaveTile(start) || !HaveTile(dest))
{
BuildShortcut();
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
UpdateFilter();
BuildPolyPath(start, dest);
return true;
}