本文整理汇总了C++中Direction::toUInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Direction::toUInt方法的具体用法?C++ Direction::toUInt怎么用?C++ Direction::toUInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direction
的用法示例。
在下文中一共展示了Direction::toUInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNextDir
/// Gets the next direction the caravane has to take
unsigned char TradeRoute::GetNextDir()
{
if(curPos == path.goal)
return REACHED_GOAL;
if(curRouteIdx >= path.route.size())
return INVALID_DIR;
Direction nextDir;
// Check if the route is still valid
if(gwg.CheckTradeRoute(curPos, path.route, curRouteIdx, player))
nextDir = path.route[curRouteIdx];
else
{
// If not, recalc it
uint8_t calculatedNextDir = RecalcRoute();
// Check if we found a valid direction
if(calculatedNextDir >= 6)
return calculatedNextDir; // If not, bail out
nextDir = Direction::fromInt(calculatedNextDir);
}
RTTR_Assert(nextDir == path.route[curRouteIdx]);
curRouteIdx++;
curPos = gwg.GetNeighbour(curPos, nextDir);
return nextDir.toUInt();
}
示例2: GetSeaId
unsigned short World::GetSeaId(const unsigned harborId, const Direction dir) const
{
RTTR_Assert(harborId);
return harbor_pos[harborId].cps[dir.toUInt()].seaId;
}
示例3: SetLeftTerrain
void SetLeftTerrain(GameWorldGame& world, const MapPoint& pt, Direction dir, TerrainType t)
{
SetRightTerrain(world, pt, Direction(dir.toUInt() + 6 - 1), t);
}