• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WaypointPath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _clearPath

void WaypointManager::_clearPath(WaypointPath &path)
{
    for(WaypointPath::const_iterator itr = path.begin(); itr != path.end(); ++itr)
        if(itr->behavior)
            delete itr->behavior;
    path.clear();
}
开发者ID:Aldrealia,项目名称:mangos,代码行数:7,代码来源:WaypointManager.cpp


示例2: SECTION_TIMER

HAAStarResult RoutePlanner::findWaypointPath(Unit *unit, const Vec2i &dest, WaypointPath &waypoints) {
    SECTION_TIMER(PATHFINDER_HIERARCHICAL);
    TIME_FUNCTION();
    _PROFILE_PATHFINDER();
    TransitionGoal goal;
    HAAStarResult setupResult = setupHierarchicalSearch(unit, dest, goal);
    nsgSearchEngine->getNeighbourFunc().setSearchSpace(SearchSpace::CELLMAP);
    if (setupResult == HAAStarResult::FAILURE) {
        return HAAStarResult::FAILURE;
    }
    TransitionCost cost(unit->getCurrField(), unit->getSize());
    TransitionHeuristic heuristic(dest);
    AStarResult res = tSearchEngine->aStar(goal,cost,heuristic);
    if (res == AStarResult::COMPLETE) {
        WaypointPath &wpPath = *unit->getWaypointPath();
        wpPath.clear();
        waypoints.push(dest);
        const Transition *t = tSearchEngine->getGoalPos();
        while (t) {
            waypoints.push(t->nwPos);
            t = tSearchEngine->getPreviousPos(t);
        }
        return setupResult;
    }
    return HAAStarResult::FAILURE;
}
开发者ID:MoLAoS,项目名称:Mandate,代码行数:26,代码来源:single_unit_path.cpp


示例3: GetPathFromOrigin

void WaypointManager::SetNodePosition(uint32 entry, uint32 dbGuid, uint32 point, uint32 pathId, WaypointPathOrigin wpOrigin, float x, float y, float z)
{
    // Support only normal movement tables
    if (wpOrigin == PATH_FROM_EXTERNAL)
        return;

    WaypointPath* path = GetPathFromOrigin(entry, dbGuid, pathId, wpOrigin);
    if (!path)
        return;

    char const* const table     = waypointOriginTables[wpOrigin];
    char const* const key_field = waypointKeyColumn[wpOrigin];
    uint32 const key            = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
    if (wpOrigin == PATH_FROM_ENTRY)
        WorldDatabase.PExecuteLog("UPDATE %s SET position_x=%f, position_y=%f, position_z=%f WHERE %s=%u AND point=%u AND pathId=%u", table, x, y, z, key_field, key, point, pathId);
    else
        WorldDatabase.PExecuteLog("UPDATE %s SET position_x=%f, position_y=%f, position_z=%f WHERE %s=%u AND point=%u", table, x, y, z, key_field, key, point);

    WaypointPath::iterator find = path->find(point);
    if (find != path->end())
    {
        find->second.x = x;
        find->second.y = y;
        find->second.z = z;
    }
}
开发者ID:cala,项目名称:mangos-classic,代码行数:26,代码来源:WaypointManager.cpp


示例4: GetPathFromOrigin

/// return true if a valid scriptId is provided
bool WaypointManager::SetNodeScriptId(uint32 entry, uint32 dbGuid, uint32 point, int32 pathId, WaypointPathOrigin wpOrigin, uint32 scriptId)
{
    // Support only normal movement tables
    if (wpOrigin != PATH_FROM_GUID && wpOrigin != PATH_FROM_ENTRY)
        return false;

    WaypointPath* path = GetPathFromOrigin(entry, dbGuid, pathId, wpOrigin);
    if (!path)
        return false;

    char const* const table     = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
    char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
    uint32 const key            = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
    WorldDatabase.PExecuteLog("UPDATE %s SET script_id=%u WHERE %s=%u AND point=%u", table, scriptId, key_field, key, point);

    WaypointPath::iterator find = path->find(point);
    if (find != path->end())
        find->second.script_id = scriptId;

    ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_CREATURE_MOVEMENT);
    if (!scm)
        return false;

    return scm->find(scriptId) != scm->end();
}
开发者ID:mangosone,项目名称:server,代码行数:26,代码来源:WaypointManager.cpp


示例5: GetPathFromOrigin

void WaypointManager::DeleteNode(uint32 entry, uint32 dbGuid, uint32 point, int32 pathId, WaypointPathOrigin wpOrigin)
{
    // Support only normal movement tables
    if (wpOrigin != PATH_FROM_GUID && wpOrigin != PATH_FROM_ENTRY)
        return;

    WaypointPath* path = GetPathFromOrigin(entry, dbGuid, pathId, wpOrigin);
    if (!path)
        return;

    char const* const table     = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
    char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
    uint32 const key            = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
    WorldDatabase.PExecuteLog("DELETE FROM %s WHERE %s=%u AND point=%u", table, key_field, key, point);

    path->erase(point);
}
开发者ID:muscnx,项目名称:Mangos021SD2,代码行数:17,代码来源:WaypointManager.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Waypoints类代码示例发布时间:2022-05-31
下一篇:
C++ WaypointList类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap